Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C Standard Library oddity

Name: Anonymous 2008-06-25 9:12

int fputc(int c, FILE *stream);

So why does fputc take an integer when it writes an unsigned char?
Believe it or not, I actually had a fucked up program because of this and it took so long to get it right because I couldn't understand what was wrong.

Name: Anonymous 2008-06-25 9:44

It's for type compatibility with getchar, which returns an int rather than unsigned char so it can include negative numbers for exceptions like EOF.

Name: Anonymous 2008-06-25 9:46

Compatibility with getc, I mean.

Name: Anonymous 2008-06-25 10:40

       ,'``.._   ,'``.
      :,--._:)\,:,._,.:      
      :`~-,''   :`.~.';\        HAVE YOU READ
       `,'       `---'  `.     YOUR SICP TODAY?
       /                 :
      /                   \
    ,'                     :\.___,-.
   `...,---'``````-..._    |:       \
     (                 )   ;:    )   \  _,-.
      `.              (   //          `'    \
       :               `.//  )      )     , ;
     ,-|`.            _,'/       )    ) ,' ,'
    (  :`.`-..____..=:.-':     .     _,' ,'
     `,'\ ``--....-)='    `._,  \  ,') _ '``._
  _.-/ _ `.       (_)      /     )' ; / \ \`-.'
 `--(   `-:`.     `' ___..'  _,-'   |/   `.)
     `-. `.`.``-----``--,  .'
       |/`.\`'        ,',');

Name: Anonymous 2008-06-25 11:01


                            .
                                      @
                       @      \   ,
                                    /          ,'``.._   ,'``.
                         \   .                :,--._:)\,:,._,.:
                                ,      ,      :`~-,''   :`.~.';\
'-._                  ___.....___     /        `,'       `---'  `.
    `.__           ,-'        \-/`-,           /                 :
        `''-------'          ( @ )  `._       /                   \
                              >->      \    ,'                     :\.___,-.
                                        \  `...,---'``````-..._    |:       \
                              .         \    (                 )   ;:    )   \  _,-.
                               \---..,--'     `.              (   //          `'    \
   ................._           \,'..--,       :               `.//  )      )     , ;
                     `-.._       ||_.-'      ,-|`.            _,'/       )    ) ,' ,'
                          `'-----''         (  :`.`-..____..=:.-':     .     _,' ,'
                                 ||          `,'\ ``--....-)='    `._,  \  ,') _ '``._
                                 ||       _.-/ _ `.       (_)      /     )' ; / \ \`-.'
                                 /\      `--(   `-:`.     `' ___..'  _,-'   |/   `.)
                                             `-. `.`.``-----``--,  .'
                                               |/`.\`'        ,',');

Name: Anonymous 2008-06-25 15:24

Name: Anonymous 2008-06-26 7:33

>>3,4,7,9,10,12
Same person

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List