char *'s and const char *'s
Stephen Clamage
steve at taumet.com
Sun Jan 13 04:47:52 AEST 1991
bruce at seismo.gps.caltech.edu (Bruce Worden) writes:
>int foo(char *file);
>... knowing that foo() really only needs a const char *, it is often called as:
> a = foo("myfile"); [ but this leads to compiler warnings ]
>What is the method preferred/recommended by professionals and other experienced individuals?
In this case I prefer to declare foo to take a const char*. Why mislead
the compiler and human readers when it is easy to be helpful?
--
Steve Clamage, TauMetric Corp, steve at taumet.com
More information about the Comp.lang.c
mailing list