Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Trying to compile Gerbil with gcc

Author: Dann Corbit

Date: 23:00:27 12/17/01

Go up one level in this thread


On December 18, 2001 at 01:09:53, Angrim wrote:

>On December 17, 2001 at 16:06:48, Dann Corbit wrote:
>>On December 16, 2001 at 08:13:26, James Swafford wrote:
><snip>
>>>I don' think gcc cares about " // ", but I'm actually using g++ now,
>>>so I can't remember for sure.
>>
>>For C code, it's an error (won't even produce an object).  For C++ code, it's
>>not a problem (of course).
>>
>>dcorbit@DANNFAST c:/tmp
>>$ cat foo.c
>>#include <stdlib.h>
>>#include <stdio.h>
>>#include <time.h>
>>int main(void)
>>{
>>   srand((unsigned)time(NULL));
>>   // pseudo-random number
>>   printf("%d\n", rand());
>>   return 0;
>>}
>>
>>dcorbit@DANNFAST c:/tmp
>>$ gcc -Wall -ansi -pedantic -O3 foo.c
>>foo.c: In function `main':
>>foo.c:7: parse error before `/'
>>
>
>Passing the -ansi flag turns off the gcc extensions to the ansi C standard,
>and as such of course it won't accept // style comments.  Just compile
>without passing -ansi.

Extensions are evil unless:
1.  Your program won't work without them.
or
2.  You never plan to use a different compiler.

I always use the ANSI flag with any of my compilers unless there is a very
compelling reason not to.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.