unnamed UNIONS 
Author Message
 unnamed UNIONS

I am currently developing a tool for use on Linux and Solaris, using
GCC to recompile my source between platforms.  However, GCC on our
sparc station (running solaris), refuses to compile code containing
unnamed union/structure members.  Does anyone know why this could be?

Also, does anyone know a way to get VC++ to behave like a true C
compiler, and allow the incorporation of nested functions?

Any help would be greatly appreciated.

Cheers

Lee.



Sun, 10 Apr 2005 05:25:08 GMT  
 unnamed UNIONS


Quote:
> I am currently developing a tool for use on Linux and Solaris, using
> GCC to recompile my source between platforms.  However, GCC on our
> sparc station (running solaris), refuses to compile code containing
> unnamed union/structure members.  Does anyone know why this could be?

> Also, does anyone know a way to get VC++ to behave like a true C
> compiler, and allow the incorporation of nested functions?

What do you call 'true C'?  Obviously not ISO standard C
(nor any of its atecedents I know of), since they do not
allow  nested functions.

Quote:
> Any help would be greatly appreciated.

Get help here:

http://www.accu.org/bookreviews/public/reviews/0sb/beginner_s_c.htm

and here:
http://www.eskimo.com/~scs/C-faq/top.html

-Mike



Sun, 10 Apr 2005 05:47:55 GMT  
 unnamed UNIONS

Quote:

> I am currently developing a tool for use on Linux and Solaris, using
> GCC to recompile my source between platforms.  However, GCC on our
> sparc station (running solaris), refuses to compile code containing
> unnamed union/structure members.  Does anyone know why this could be?

Possibly because unnamed union/structure members are not part of the C
language.

Quote:

> Also, does anyone know a way to get VC++ to behave like a true C
> compiler, and allow the incorporation of nested functions?

It behaves like a true C compiler by not allowing the incorporation of
nested functions. If you want Pascal, you know where to find it.

<snip>

--

"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton



Sun, 10 Apr 2005 06:01:50 GMT  
 unnamed UNIONS


Quote:

> > I am currently developing a tool for use on Linux and Solaris, using
> > GCC to recompile my source between platforms.  However, GCC on our
> > sparc station (running solaris), refuses to compile code containing
> > unnamed union/structure members.  Does anyone know why this could be?

> Possibly because unnamed union/structure members are not part of the C
> language.

Except bit fields. :-)  I was poking around the standard
and noted this exception, but didn't see an immediately
evident statement about this for other types, so I left
this question alone.

-Mike



Sun, 10 Apr 2005 07:22:30 GMT  
 unnamed UNIONS

Quote:

> I am currently developing a tool for use on Linux and Solaris, using
> GCC to recompile my source between platforms.  However, GCC on our
> sparc station (running solaris), refuses to compile code containing
> unnamed union/structure members.  Does anyone know why this could be?

Unnamed structure and union members, except for bit-fields,
aren't in the C standard.  But if you upgrade to a recent version
of GCC, they are supported for compatibility with other
compilers.


Sun, 10 Apr 2005 07:32:17 GMT  
 unnamed UNIONS
Originating from a low-level background, I've only ever used GCC for
compilation of C/C++ source code, yet have experienced no problems
when generating code containing nested functions.

As many of my projects involve a combination of assembly + high-level
source, and consist of sub-functions only relevant within the context
of another, it is often more efficient to eliminate parameter passing
and maintain cache coherence by availing an existing stack frame
during the execution of a nested sub-function.

In order to facilitate the polymorphic nature of C++, many compilation
systems employ stack convolution and thus assume an indeterminate
finite stack frame.  As a "TRUE" C platform, by definition but
possibly not implementation, should always resolve a determinable
finite stack frame, nested function generation is both an attractive
and optimising feature.

With this in mind, maybe I should rephrase the question as follows:
"Does anyone know if VC++ has a compilation switch, which when
activated, enables it to return a determinable finite stack frame?"

That said, if this is an "undocumented" language feature infrequently
deemed appropriate by a majority high-level user base, I guess it is
specific to the GCC implementation.

Cheers

Lee



Mon, 11 Apr 2005 02:55:42 GMT  
 unnamed UNIONS

Quote:

> Originating from a low-level background, I've only ever used GCC for
> compilation of C/C++ source code, yet have experienced no problems
> when generating code containing nested functions.

> As many of my projects involve a combination of assembly + high-level
> source, and consist of sub-functions only relevant within the context
> of another, it is often more efficient to eliminate parameter passing
> and maintain cache coherence by availing an existing stack frame
> during the execution of a nested sub-function.

> In order to facilitate the polymorphic nature of C++, many compilation
> systems employ stack convolution and thus assume an indeterminate
> finite stack frame.  As a "TRUE" C platform, by definition but
> possibly not implementation, should always resolve a determinable
> finite stack frame, nested function generation is both an attractive
> and optimising feature.

> With this in mind, maybe I should rephrase the question as follows:
> "Does anyone know if VC++ has a compilation switch, which when
> activated, enables it to return a determinable finite stack frame?"

> That said, if this is an "undocumented" language feature infrequently
> deemed appropriate by a majority high-level user base, I guess it is
> specific to the GCC implementation.

While your motives may be admirable, the subject of specific
implementation features remains OT on c.l.c.  It cannot be
answered by reference to the ISO standard.

I suspect the only reason gcc has that extension is to cater to
languages with the feature, such as Pascal and Ada.  Microsoft
caters to nobody other than Gammon, let alone industry standards.
It might be possible with some form of non-standard attribute, but
nobody here is likely to have any such knowledge.

--

   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!



Mon, 11 Apr 2005 06:33:03 GMT  
 unnamed UNIONS
in comp.lang.c i read:

Quote:
>Originating from a low-level background, I've only ever used GCC for
>compilation of C/C++ source code, yet have experienced no problems
>when generating code containing nested functions.

gcc is very much like other compilers, it provides extensions to the
language, which this must be since c contains no such provisions.
unfortunately what defaults to enabled in one version might be disabled,
missing or operate differently in another.  but in this group we discuss
the standardized language.  you want the gcc-help mailing list -- see
<http://www.gnu.org/ml/> for more information.

Quote:
>"Does anyone know if VC++ has a

and for this sort of thing you want microsoft.public.vc.ide_general, i
think.

--
bringing you boring signatures for 17 years



Wed, 13 Apr 2005 16:10:29 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. help: unnamed unions within structures

2. unnamed struct/union in C99

3. Power of Unions ( surely union in C )

4. Create instance of unnamed class that implements interface

5. MC++ unnamed structs gives linker error

6. Does C support unnamed parameters?

7. C99 and unnamed substructures

8. Unnamed bitfield (the story!)

9. Excel: Unnamed Range

10. unnamed namespace and the watch window

11. Unnamed namespaces.

12. Unnamed namespace question

 

 
Powered by phpBB® Forum Software