Live data from Hacker News

The most useful GCC options and extensions

antoarts.com

1–10 of 22 posts

Re: The most useful GCC options and extensions

#2
A few others I use are -Wsign-compare and -Wformat-nonliteral. Sign compare warns on possible bugs/vulnerabilities due to comparing signed and unsigned values. Using nonliteral formats can lead to vulnerabilities (such as the famous attacks on FTP servers http://seclists.org/bugtraq/1999/Sep/328)

Re: The most useful GCC options and extensions

#3
I was definitely not expecting an article about useful GCC options to mention -trigraphs. The -ansi option isn't particularly useful either, imo, since just about every interesting program is going to do something crazy like open a network socket or list the files in a directory.

By far the most useful gcc extension wasn't mentioned at all. typeof().

Re: The most useful GCC options and extensions

#4

I was definitely not expecting an article about useful GCC options to mention -trigraphs. The -ansi option isn't particularly useful either, imo, since just about every interesting program is going to do something crazy like open a network socket or list the files in a directory. By far the most useful gcc extension wasn't mentioned at all. typeof().

I mentioned trigraphs as an example of a C standard feature disabled by default in GCC, and then I just mentioned how to enable just that feature. It wasn't supposed to be included among the most important options, it just got there ;-).

Re: The most useful GCC options and extensions

#6
Sometimes when compiling and trying to use system calls gcc will complain about the functions not existing. This is usually because of some preprocessor guard not being defined. An easy way to see what macros have been defined is to run gcc with the "-E -dM" flags.

Re: The most useful GCC options and extensions

#10

A few others I use are -Wsign-compare and -Wformat-nonliteral. Sign compare warns on possible bugs/vulnerabilities due to comparing signed and unsigned values. Using nonliteral formats can lead to vulnerabilities (such as the famous attacks on FTP servers http://seclists.org/bugtraq/1999/Sep/328 )

-Wall includes -Wsign-compare
Post reply on HN