> On 17/01/2015 18:51, "Philipp Klaus Krause" <p...@spth.de> wrote:
>
>>Currently, when compiling using --std-sdcc89 or --std-sdcc99 (but not
>>when using --std-c89, --std-c99 or --std-c11), sdcc allows functions
>>with return type void to return expressions of type void. Example:
>>
>>void f1(void);
>>
>>void f2(void)
>>{
>>  return(f1());
>>}
>>
>>In standard C, this is not allowed (unlike C++, where it can be useful
>>in C++ templates).
>>
>>In anyone using this feature?
>>
>>If not, I'd suggest to drop it after the next release.
>>
>>Philipp
>>
>>
>
> I'm ok with dropping this.

I consider this a useful feature. I do not see a reason why C needs to
make a difference between these two cases:
void f1(void);
void f2(void) { f1(); return }
char f3(void);
char f4(void) { return f4(); }

I prefer to use f1/f2 in the same manner as f3/f4.

And apart from templates, this is also useful with macros. E.g. when the
return type is a macro. The alternative is lots of ugly #if constructions
to see if the return type happens to be void and insert different code
accordingly.

Maarten

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to