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:32

▄▀▀▀▀▀▀▀█████▄ ▀▀▀▀▀██████▄ ▀▀█████▄ ▀▀▀▀▀▀█████████▄ ██▄  ▄▀▀████▄
█         ▀▌▀██       ▐▀ ▀███  ▐▀ ▀██        ▀▌ ▀▀████  ██  █  ▐ ▀██
█            ▐█    ▄▄     ▀██      ▐█              ▀▐█  ▐█  █     ▐█
▓       ▄▄▄▄▄▄▀   █  █     ▐▓       ▓ ▄▄        ▄▄▄▄▄▀   █  █      ▓
▒      █          ▀▀▀▀      ▒       ▒   ▒      ▒  ▄       ▀▀       ▒
░       ▀▀▀▀▄               ░       ░   ░      ░  ░                ░
░           ▀      ▄▄       ░       ░   ░      ░  ░       ▄▄       ░
░      ▄▀▀▀▀      █  █      ░       ░   ░      ░  ░      ░  ░      ░
▒░    ░▓   ░░    ░█  █░    ░▒      ░▒   ▒░    ░▒  ▒░    ░▒  ▒░    ░▒
▓▒░  ░▒▒   ▒▒░  ░▒█  █▒░  ░▒▓     ░▒▓   ▓▒░  ░▒▓  ▓▒░  ░▒▓  ▓▒░  ░▒▓
█▓▒░░▒▓▓   ▓▓▒░░▒▓█  █▓▒░░▒▓█    ░▒▓█   █▓▒░░▒▓█  █▓▒░░▒▓█  █▓▒░░▒▓█
 ▀▀▀▀▀▀     ▀▀▀▀▀▀    ▀▀▀▀▀▀  ▀▀▀▀▀▀     ▀▀▀▀▀▀    ▀▀▀▀▀▀    ▀▀▀▀▀▀

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 9:50

▄▀▀▀▀▀▀▀█████▄ ▀▀▀▀▀██████▄ ▀▀█████▄ ▀▀▀▀▀▀█████████▄ ██▄  ▄▀▀████▄
█         ▀▌▀██       ▐▀ ▀███  ▐▀ ▀██        ▀▌ ▀▀████  ██  █  ▐ ▀██
█            ▐█    ▄▄     ▀██      ▐█              ▀▐█  ▐█  █     ▐█
▓       ▄▄▄▄▄▄▀   █  █     ▐▓       ▓ ▄▄        ▄▄▄▄▄▀   █  █      ▓
▒      █          ▀▀▀▀      ▒       ▒   ▒      ▒  ▄       ▀▀       ▒
░       ▀▀▀▀▄               ░       ░   ░      ░  ░                ░
░           ▀      ▄▄       ░       ░   ░      ░  ░       ▄▄       ░
░      ▄▀▀▀▀      █  █      ░       ░   ░      ░  ░      ░  ░      ░
▒░    ░▓   ░░    ░█  █░    ░▒      ░▒   ▒░    ░▒  ▒░    ░▒  ▒░    ░▒
▓▒░  ░▒▒   ▒▒░  ░▒█  █▒░  ░▒▓     ░▒▓   ▓▒░  ░▒▓  ▓▒░  ░▒▓  ▓▒░  ░▒▓
█▓▒░░▒▓▓   ▓▓▒░░▒▓█  █▓▒░░▒▓█    ░▒▓█   █▓▒░░▒▓█  █▓▒░░▒▓█  █▓▒░░▒▓█
 ▀▀▀▀▀▀     ▀▀▀▀▀▀    ▀▀▀▀▀▀  ▀▀▀▀▀▀     ▀▀▀▀▀▀    ▀▀▀▀▀▀    ▀▀▀▀▀▀

Name: Anonymous 2008-06-25 10:23

>>5
Ar good idea, its probs gona butcher it but i wana get it done lol

Name: Anonymous 2008-06-25 10:40

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

Name: Anonymous 2008-06-25 10:48

'-._                  ___.....___                           ___,,,,,___                  _,-'
    `.__           ,-'        ,-.`-,                     .-`,-.        '-.           __,`
        `''-------'          ( p )  `._               _,`  ( q )          '-------''`
                              `-'      \             /      '-`
                                        \           /
                              .         \           /         ,
                               \---..,--'           '--.,,---/
   ................._           --...--,             .--,,,--           _,,,,,,,,,,,,,,,,,
                     `-.._         _.-'               '-,_         _,,-`
                          `'-----''                       ''-----'`

Name: Anonymous 2008-06-25 11:01


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

Name: Anonymous 2008-06-25 15:24


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