473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

union question

do you know if there is some upper bound on the number of members that
can be contained in a union?
Jul 19 '05 #1
3 1650
Luca wrote:
do you know if there is some upper bound on the number of members that
can be contained in a union?


Why do you ask ?

It's probably implementation dependant.

Jul 19 '05 #2
Apart from the usual retrictions in C++ i.e. no static variables (in
unions), no virtual member functions (in unions), no overloading the =
operator, there is no direct reference in Herb Schildt's manual to any
"upper bound".

Try it yourself and see what happens
Andrew Curzon (UK, C++ Programmer)

"Gianni Mariani" <gi*******@mariani.ws> wrote in message
news:bi********@dispatch.concentric.net...
Luca wrote:
do you know if there is some upper bound on the number of members that
can be contained in a union?


Why do you ask ?

It's probably implementation dependant.

Jul 19 '05 #3

"Andew Curzon" <an************@ntlworld.com> wrote in message news:FA******************@newsfep1-win.server.ntli.net...
Apart from the usual retrictions in C++ i.e. no static variables (in
unions), no virtual member functions (in unions), no overloading the =
operator, there is no direct reference in Herb Schildt's manual to any
"upper bound".


Fortunately nobody implements a compiler to Schildt's recommendations.
The standard doesn't require that there be either a maximum or minimum
number of union elements supported, but suggests 4096 as the minimum
the implementation su pport.
Jul 19 '05 #4

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

Similar topics

4
by: James DeClerk | last post by:
Hi everyone. I'm new to C++ and I've got a seemingly tough problem to tackle. I have a union. This union needs to be converted into hexadecimal format. The hexadecimal number is then...
2
by: Barry Schwarz | last post by:
Given a union of the form union { T1 m1; T2 m2;}obj; where T1 and T2 are different scalar (non-aggregate) types. The C99 standard states that obj.m1 = value; if (obj.m2 ... invokes...
73
by: Sean Dolan | last post by:
typedef struct ntt { int type; union { int i; char* s; }; }nt; nt n; n.i = 0;
2
by: marco | last post by:
Dear List, as it seems, MS SQL as used in Access does not allow a select INTO within a UNION query. Also, it seems that a UNION query can not be used as a subquery. Maybe my (simplified)...
16
by: tedu | last post by:
does anyone know of a platform/compiler which will place union elements to not overlap? as in union u { int a; long b; size_t c; }; in my limited experience, writing to any of (a, b, or c)...
8
by: wkaras | last post by:
In my compiler, the following code generates an error: union U { int i; double d; }; U u; int *ip = &u.i; U *up = static_cast<U *>(ip); // error I have to change the cast to...
10
by: piboye | last post by:
Hi ! I'm a academician in china. I have been intereted in C++ lasting. In reading the C++ Primer book, i have a trouble about union. In the book ,it said that union can have constructors and...
30
by: Yevgen Muntyan | last post by:
Hey, Why is it legal to do union U {unsigned char u; int a;}; union U u; u.a = 1; u.u; I tried to find it in the standard, but I only found that
5
by: wugon.net | last post by:
question: db2 LUW V8 UNION ALL with table function month() have bad query performance Env: db2 LUW V8 + FP14 Problem : We have history data from 2005/01/01 ~ 2007/05/xx in single big...
9
by: dspfun | last post by:
Hi! I have stumbled on the following C question and I am wondering wether the answer is implementation specific or if the answer is always valid, especially question b). BRs! ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...

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.