473,883 Members | 2,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing a union's field to a function


The sample program below is compiled fine by gcc (with -Wall), but rejected
by Sun's SUNWspro compiler (version 6 update 2).

The point of contention is, whether a value for one of the union's types can
be passed to a function directly -- without creating a separate variable of
the union type and assigning the appropriate field of it.

Is gcc being too liberal, or is this behavior simply part of a newer
C-standard, which Sun's old compiler is not supporting? Thanks!

Aug 11 '06
50 6514
Dik T. Winter wrote:
Well, the news-reader I am using would not recognise an attachment when
you waved it in front of its eyes. šConsider, it is just piping the
article contents through "more". š(Not really, but it is very similar.)
The textual, unencoded attachment should be just as visible through more, as
the text beyond the customary "------ cut here ------" is...

Is it not?

Aug 15 '06 #51

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: kazack | last post by:
I am a little confused with code I am looking at. My c++ book does not go into passing a structure to a function so I pulled out a c book which does. and I do not understand the prototype verses the actual function call. I will post the code below of the structure, the prototype and and function call and if someone can explain this I would be very appreciative: struct data { float amount; string fname;
by: Paradigm | last post by:
I am using Access 2K as a front end to a MYSQL database. I am trying to run a Union query on the MYSQL database. The query is (much simplified) SELECT as ID from faxdata UNION SELECT as ID from letdata UNION SELECT as ID FROM MEMODATA; I get an ODBC error. The same query runs when the backend files are MDB files and it runs with MYSQL if I only combine 2 tables.
by: shaun palmer | last post by:
when or Where do you use a union query ? how can I wright sql, tblPopulation,* tblcustomer,* one to one with all the appropriate attributes(field). Your help would be greatly appreciated. Thank you.
by: turtle | last post by:
I need to get the results of two queries into one. I need all the data from both queries (i guess this is a full join or outer join). Can I do a union query. Query1 Job Budget Function 1 10 Electrical Engineer 1 5 Mechanical Engineer 2 20 Elecrical Engineer
by: Peter Dunker | last post by:
Hi, I will write ANSI C89. Is the following struct defenition correct ? I wrote it with VC6(Windows IDE) and at first no Problem. As I changed a compiler switch to 'no language extension', the compiler said that the union has no name. Is it right that in ANSI C the union must be named inside this kind of structure ?
by: Christopher Benson-Manica | last post by:
Does the following program exhibit undefined behavior? Specifically, does passing a struct by value cause undefined behavior if that struct has as a member a pointer that has been passed to free()? #include <stdlib.h> struct stype { int *foo; };
by: mikes | last post by:
I have 2 separate queries, which effectively are the same except they draw data from separate tables. Both tables are (design-wise) identical, only the data is different. for each query, there are 2 tables with a standard LEFT JOIN. One field of the query is calculated, looking for a NULL in one table, and then using a field from the second table in that case. One query looks like this: PARAMETERS Text ( 255 ); SELECT...
by: BerkshireGuy | last post by:
I have the following union query: SELECT Count(PolicyNumber) AS TotalSubmitted, "TOTAL SUBMITTED" as Header, "Combined" as TelemedClass, "1" as GroupA,"1" as Postion FROM tblAppActivity WHERE AppStatusSort = "1" And RDLastTransaction Between #01/01/2006# and #09/30/2006# UNION ALL SELECT Count(PolicyNumber) AS TotalTelemedSubmittedIC, "TOTAL TELEMED
by: Richard Harter | last post by:
There is probably a simple way to do what I want but I don't see it. Any suggestions are welcome. Suppose I have a function foo with an argument that can be any of several types and that I want to use a union for that argument. In a header file there is the following: #define VAL_ALT union urt_value_alt .....
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.