Re: Why does this work? (rot13 function)

From: Larry Doolittle (ldoolitt_at_recycle.lbl.gov)
Date: 12/16/03


Date: Tue, 16 Dec 2003 20:56:54 +0000 (UTC)

Arthur J. O'Dwyer wrote:
> <OT> Using gcc, it's easy:
> % gcc -W -Wall -ansi -pedantic -O2 mainfile.c rot13.c
> (and any other source files in the project). All the options
> are only there to catch mistakes in your code; if you write
> perfect code, you don't need them. ;-) [In other words, you
> *do* need them. Always.]
></OT>

My biggest complaint about gcc -W -Wall is that it barks at unused
parameters. If someone tells me how to make

int foo(void);
int bar(char*cd)
{
        foo();
        return 0;
}

standards-conforming, non-bloated, and run past "gcc -W -Wall -ansi -std=c99"
without warnings, I'd like to hear about it. My default set of
flags to gcc now also includes
   -Wpointer-arith -Wcast-qual -Wshadow

   - Larry



Relevant Pages

  • Re: compile int as 64 bit on a 64 bit machine?
    ... machine with gcc. ... Seems by default the int is treated as 4bytes. ... Can you define int as _int64, long long, or whatever in the ... or more likely the OP's predecessors' mistakes). ...
    (comp.lang.c)
  • Re: data types
    ... Usually short is smaller than an int. ... Your compiler is either *really* old or broken or both. ... recommend either a version of gcc,, or Visual Studio ... Microsoft's Visual Studio Express has an onerous EULA). ...
    (comp.lang.c)
  • Re: stream io in c
    ... zero to 255, putchar'ing in the body of the loop, then redirecting output ... int main ... // gcc -o chars mkchars1.c ... This compiles but gcc warns of incompatible pointer types. ...
    (comp.lang.c)
  • Re: [RFC] Generic population count function
    ... - gcc builtin - cpufunc inline ... int ffs_builtin ... Note clang generates very inefficient code for ffslfrom cpufunc.h. ... bsfq() returns a result ...
    (freebsd-arch)
  • Re: A basic (?) problem with addresses (gcc)
    ... Assuming int and float are the same sizes and ... The problem with many people is that they will never accept that gcc has ... int main ... -- a type compatible with the effective type of the object, ...
    (comp.lang.c)