473,387 Members | 1,891 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.

with -compat=5 of CC 5.4 error with version as structure tag

Need to find the cause of the following error:

The sample code goes as follows:( file name version.cpp )
#include <iostream>
struct version
{
int val;
};

int main()
{
version Test;
Test.val=0;
return (0);
}

Compilation environment:
Sun Forte 7 Developer, CC version 5.4

Observation:
* /opt/SUNWspro/bin/CC version.cpp ( By default the -compat is 5 )
"version.cpp", line 3: Error: version is not a structure tag.

* /opt/SUNWspro/bin/CC -compat version.cpp ( This means -compat=4 )
No Error, compilation suzzessful

* When you don't include <iostream>, there is no problem with -compat=5
also.

* When any other structure tag is used, thgere is no error.

Is it because there is some funtiion, datatype already included in
the standard library with the name "version"? C++ puts the structure
tags and other dataTypes in same namespace.

Jul 22 '05 #1
1 1549
"sreak" <sa**********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Need to find the cause of the following error:

The sample code goes as follows:( file name version.cpp )
#include <iostream>
Nit: You're not using anything from this header.
struct version
{
int val;
};

int main()
{
version Test;
Test.val=0;
return (0);
Nit: 'return' is not a function. No parentheses are
required around the argument (but they're not prohibited either). }
The above program is completeley valid standard C++, and
a compiler that rejects it does not conform to the standard.

Compilation environment:
Sun Forte 7 Developer, CC version 5.4

Observation:
* /opt/SUNWspro/bin/CC version.cpp ( By default the -compat is 5 )
"version.cpp", line 3: Error: version is not a structure tag.

* /opt/SUNWspro/bin/CC -compat version.cpp ( This means -compat=4 )
No Error, compilation suzzessful

* When you don't include <iostream>, there is no problem with -compat=5
also.

* When any other structure tag is used, thgere is no error.

Is it because there is some funtiion, datatype already included in
the standard library with the name "version"? C++ puts the structure
tags and other dataTypes in same namespace.


Your questions are about your compiler, not the language,
so not topical here.

Try consulting support resources for your compiler.

'version' is not a reserved word in C++, so a compiler
that won't let you use it in a conforming program is
broken or not configured to be standard-conforming.

-Mike
Jul 22 '05 #2

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

Similar topics

7
by: Darren Gamble | last post by:
Good day, I've sent a message on this to the php-general list already, but unfortunately no one replied. Sorry for the repost. to those that read both... I'm having a problem working with an...
7
by: kecebong | last post by:
I tried to compile php 4.3.3 with gd but it doesn't work, it wasnt show in phpinfo(). My system is redhat 9 and apache 2.0.47 webserver.
8
by: tmb | last post by:
1 - Can you build an entire web page or site with Java... sorta like you can with Flash? 2 - Can you do... .. Drag & Drop .. Push Buttons .. Hot Spot .. Hot Object .. Pull Down's (combo...
2
by: Benji99 | last post by:
Hi guys, I'm starting to learn Python and so far am very impressed with it's possibilities. I do however need some help with certain things I'm trying to do which as of yet haven't managed to find...
137
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
99
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a...
8
by: Robert | last post by:
Hi, I can use "with" like this: function MyObject(message) { this.message = message; } function _MyObject_speak() {
24
by: Bob Alston | last post by:
Most of my Access database implementations have been fairly small in terms of data volume and number of concurrent users. So far I haven't had performance issues to worry about. <knock on wood> ...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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.