|
From: Per W. <pw...@ia...> - 2004-08-17 22:48:20
|
#pragma is a way to implement compiler-specific extensions to inform the
compiler about different things, such as activate/deactvate different
warnings etc. One problem with #pragma is that there are no standard for
supported parameters.
It is common practice for compilers to warn whenever they see a #pragma
that they don't support, to inform the developer that either the #pragma
isn't needed, needs to be changed to something else or specifies something
that the currently used compiler can not solve, i.e. maybe the actual code
must be rewritten.
You really should try to keep down on use of #pragma statements since they
may make your code non-portable. If you use a #pragma to suppress warnings
about unused parameters, most other compilers will not understand that
#pragma and will emit warnings about the unused parameters and possibly an
extra warning about the unknown #pragma.
Rewrite the function header as:
int main(int,char* argv[]) {
...
}
in case you really don't want to use argc but still want to avoid the
warning.
/Per W
On Tue, 17 Aug 2004, Marie Boulet wrote:
> Why does it ignore the pragma?
>
> C:/Documents and Settings/Jean Pierre/Bureau/No.c:9: warning: ignoring
> #pragma argc
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <dir.h>
>
> #pragma argc
> int main (int argc, char *argv[]){
>
> if(mkdir(argv[1]) == -1)
> printf("%s erreur.\n");
> else
> printf("%s ok.\n", argv[1]);
>
> return 0;
> }
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|