Stricter requirements for function main signature

Andrew Haley aph@redhat.com
Tue Apr 8 14:56:00 GMT 2008


Ramon Bertran Monfort wrote:
> Well,
> first of all, thanks for answering.
> 
>> Why don't you just define main() correctly?  argv should be 'char **', 
>> and envp should probably be 'char **'.  How can you possibly have an 
>> envp that's a long long unsigned int?
> 
> If a follow the SDK3.0 programming guide, it tells me that the spe main 
> function has three parameters: the spe id, and two pointers to application 
> specific data. The last two are optional.

But you passed not a pointer but a long long unsigned int.  Why not pass a
pointer instead of a long long unsigned int, especially since that's
what the programming guide tells you to do?

> I can try to change the signature to the 'correctly' one ... but doing this 
> will break the spe run-time probably. (I've to experiment with this).  
> Anyway, sometimes I use three parameters witch is not allowed with the 
> 'correct' strict signature.

g++ allows the third argument to be a pointer.

> I know that there are workarounds for solving this issues, but I'm 
> wondering if there is any gcc flag to relax this strict condition. It would 
> be easy to port applications to gcc 4.3.0 such as the Cell application 
> which changing the code is not as straightforward as the example shown in 
> http://www.gnu.org/software/gcc/gcc-4.3/porting_to.html .

>> Also, what are the compiler options you're using?
> 
> I guess that does not matter. I'm using just 'spu-g++ -O2' for testing.

Ah, OK.  It seems that you have been caught by a version of gcc that treats
this as an error rather than a warning.  I'm not sure exactly when this
changed, but the current development version has a warning, not an error.

Andrew.



More information about the Gcc-help mailing list