Re: [ILUG] gcc optimisation weirdness?

From: Dave Airlie (David.Airlie at domain ul.ie)
Date: Thu 11 May 2000 - 11:06:17 IST


unspecified return type is int AFAIK,

Dave.

On Thu, 11 May 2000, Shane Dempsey wrote:

>
> Hiya Kenn,
> Point taken. It is a valid and standard alternative
> to using the kind of masks that I normally use.
> It might even be a lot tidier. I guess that I was
> talking from a windows-founded ivory tower
> where we use glorious macros for these kind
> of things.
>
> I'd be very interested if anyone could test the following code
> for me using gcc.
> // ===================================
> // AFAIK this shouldn't compile but VC++ thinks this
> // is just peachy.
>
> struct PreludeToFailure(
> PreludeToFailure( int stuff ) : _internalStuff( stuff ) { }
>
> int _internalStuff;
> }
>
> main ()
> {
>
> // do some stuff here
> // ...
> return 0;
>
> }
>
> // ===================================
>
> This compiles under VC++ event with the strict ANSI compliance
> turned on ( -Za option for the MSVC compiler )
> despite ANSI C requiring an int return type from main.
> The program crashes - no shit - but still compiles as
> the struct takes an int in the constructor.
>
> Just wondering if gcc is as badly behaved. I doubt it.
>
> ...shane
>
>
>

-- 
------------ David Airlie, David.Airlie at domain ul.ie,airlied at domain skynet --------
Telecommunications Research Centre, ECE Dept, University of Limerick \
http://www.csn.ul.ie/~airlied	-- Telecommunications Researcher      \
--- TEL: +353-61-202695 -----------------------------------------------


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:06:06 GMT