[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: g++ flag?
From: |
llewelly |
Subject: |
Re: g++ flag? |
Date: |
Fri, 14 May 2004 22:29:25 -0600 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (berkeley-unix) |
Hendrik Belitz <honkaonka.belitz@fz-juelich.de> writes:
> Default User wrote:
>
>> Abhisek Sinha wrote:
>>
>>> Earlier compilers used to take the default return type of any function
>>> to be int.
>>> g++, in this case where ther is no return type specified gives error
>>> as
>>> error: ISO C++ forbids declaration of `main' with no type
>>
>> That is correct, it's illegal.
>>
>>> can this be disabled using any g++ flag in 3.3.3
>
> This is for backward compability and the compilation of legacy code, I
> think.
>
>>> It is to be noted that gcc(3.3.2) does not throw any any error even if
>>> there is no return type.
>>> Not even with -ansi and -pedantic flag
>
> That's only true if you activate the flag. Regarding my experience, the gcc
> 3.3.x is very rigourous in reporting such things, especially when using
> -ansi and/or -pedantic.
>
>> gcc is a C compiler and not a C++ compiler.
>
> Well, that's wrong, since gcc is the Gnu Compiler Collection, which
> supports C, C++, Java and many more...
'GCC' (note, all caps) is the Gnu Compiler Collection.
'gcc' (note, all lower case) is just the compiler-driver, which can
recoginize any langauge (by filename extension :-/), but assumes
C linking conventions, and is thus not suitable for non-C
programs which do not have special linking needs.