Thread: Compiler for C

  1. #16
    Registered User
    Join Date
    Jan 2008
    Posts
    69
    Quote Originally Posted by Elysia View Post
    GCC does not have narrowing data conversion warnings, which is bad for beginners. Visual Studio has, so I definitely recommend it over GCC for beginners.
    What do you mean by "narrowing data conversion warnings"?

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Code:
    int Int = 1000000;
    char Char = Int;
    The int will not fit inside Char, so it should trigger a warning because you are narrowing the size.
    GCC does not issue such warnings.
    Disclaimer: Untested.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    The int will not fit inside Char, so it should trigger a warning because you are narrowing the size.
    As I have pointed out before, there is no requirement to warn about that, so "should" here is personal opinion, which happens to coincide with my personal opinion.

    If blackcell used gcc on Unix, then I would consider it best to use the MinGW port of gcc anyway. On the other hand, using an entirely different compiler makes for good exposure to different tools.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #19
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by laserlight View Post
    As I have pointed out before, there is no requirement to warn about that, so "should" here is personal opinion, which happens to coincide with my personal opinion.
    I'm not saying it must. I would prefer it does and it's more helpful to newbies, as well.
    That's all.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #20
    Registered User
    Join Date
    Feb 2008
    Posts
    19
    GCC has lots of options like Wall -pedantic...and many others I cant remember, gives you all the warnings you want eheh. With CodeBlocks you can simply set it under settings/compiler and debugger, some are already there to chose, others you can add em manually.


    Essential if you wanna use GCC IMHO:

    http://www.network-theory.co.uk/docs/gccintro/

    found what I wanted:
    http://c-faq.com/resources/fn86.html
    Last edited by 2112; 03-05-2008 at 06:01 AM.

  6. #21
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    GCC has lots of options like Wall -pedantic...and many others I cant remember, gives you all the warnings you want eheh.

    found what I wanted:
    http://c-faq.com/resources/fn86.html
    As far as I can tell*, it will not emit the warnings Elysia mentioned even with what you found.

    * with the MinGW port of gcc 3.4.5
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #22
    Registered User
    Join Date
    Feb 2008
    Posts
    19
    Ok, just tried with GCC 4.2.3 and using those options and it doesn't warn either.
    Maybe there's some other option but I don't know...

  8. #23
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    GCC does not support the warning. It was mentioned in another thread somewhere (where someone who had knowledge about it quoted that it did not support these warnings).
    It's not required, so GCC opts not to support it.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #24
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    'Twas I. http://cboard.cprogramming.com/showthread.php?t=99468
    Well, I found a quote by someone else, anyway.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  2. Compiler Paths...
    By Cobra in forum C++ Programming
    Replies: 5
    Last Post: 09-26-2006, 04:04 AM
  3. C Compiler and stuff
    By pal1ndr0me in forum C Programming
    Replies: 10
    Last Post: 07-21-2006, 11:07 AM
  4. I can't get this new compiler to work.
    By Loduwijk in forum C++ Programming
    Replies: 7
    Last Post: 03-29-2006, 06:42 AM
  5. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 11:28 AM