473,396 Members | 2,147 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,396 software developers and data experts.

Is this legal?


class A {
public:
enum E { EN1, EN2, EN3 };
};

class B {
public:
void f(const char *s, A::E en = A::E::EN1);
};

MSVC 7.1 accepts it, G++ 3.2.2 (3.2.2-3mdk) gives the following error:
`A::E' is not an aggregate type

Is this an error in G++ or in VC? What does the Holy Standard say?
Jul 22 '05 #1
3 3956
red floyd wrote:

class A {
public:
enum E { EN1, EN2, EN3 };
};

class B {
public:
void f(const char *s, A::E en = A::E::EN1);
};

MSVC 7.1 accepts it, G++ 3.2.2 (3.2.2-3mdk) gives the following error:
`A::E' is not an aggregate type

Is this an error in G++ or in VC? What does the Holy Standard say?


Oops. The error is in reference to the A::E::EN1 default parameter value.
Jul 22 '05 #2
red floyd wrote:
red floyd wrote:

class A {
public:
enum E { EN1, EN2, EN3 };
};

class B {
public:
void f(const char *s, A::E en = A::E::EN1);
};

MSVC 7.1 accepts it, G++ 3.2.2 (3.2.2-3mdk) gives the following error:
`A::E' is not an aggregate type

Is this an error in G++ or in VC? What does the Holy Standard say?

Oops. The error is in reference to the A::E::EN1 default parameter value.


Enumerators are names in the same scope where the enumeration type
is declared. I.e. to get to EN1, you say A::EN1, not A::E::EN1.

Victor
Jul 22 '05 #3
Victor Bazarov wrote:
red floyd wrote:
[enumeration scope question redacted]

Enumerators are names in the same scope where the enumeration type
is declared. I.e. to get to EN1, you say A::EN1, not A::E::EN1.

Victor


Thanks, Victor. Appreciate the help.
Jul 22 '05 #4

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

Similar topics

1
by: pakkocool | last post by:
¿Como ganar dinero en internet? Lee atentamente el siguiente texto, es super interesante y te hara ganar muchos dolares si sigues las instrucciones y le pones empeño: Hace unos días que...
3
by: Chris Johnson | last post by:
Greetings all: I come across an interesting question (to me anyway) and I do not know the answer. Code/Questions follow: #include <iostream> #if 0 // uncommenting *should* make call...
7
by: Nice | last post by:
Hi. I read somewhere that in XML the tag <xml> is not legal. But in W3C specs I can't find this statement. Does anyone know about it ?
0
by: mykidisgollum | last post by:
Greetings, I have code which prints a document who's attributes are saved as flags in a database. One of the those attributes is letter or legal. When I am printing, I use the following...
7
by: __PPS__ | last post by:
Actually what I mean is that - if I have some memory buffer, lets say char a; and then I do like this: DWORD num = 0x1234; *(DWORD*)a = num; (1) *(DWORD*)(a+1) = num; (2) either...
6
by: aj | last post by:
I currently have 2 official DB2 Workgroup Edition licenses for my 2 v8 production servers. I also have tech support/software upgrade agreements in place for both servers. I am interested in...
2
by: Thomas Paul Diffenbach | last post by:
I'm trying to write a space efficient string (nul terminated array of char), storing the characters directly unless the number of characters is too large to be so stored, and storing a pointer to...
1
by: Wiktor Zychla | last post by:
is it legal to distribute axshdocvw, shdocvw and mshtml.dll with my application? is it legal to distribute Microsoft.mshtml.dll from 'Primary Interop Assemblies' folder (I assume it comes with...
11
by: Alberto Giménez | last post by:
Hi, I've seen some object oriented programming bits out there and i'm not sure if they're legal. For example: struct Object { int field1; int field2; }; struct SubObject { int field1; /*...
2
by: Army1987 | last post by:
Is this program legal C89? /* no headers included */ int main(void) { if (sizeof (exit(0), 0), ((void (* )(int))&exit)( (puts((const char *)"hello, world"), 0) ), 0) {
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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:
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.