473,568 Members | 2,986 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.cp p", 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 1554
"sreak" <sa**********@y ahoo.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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.cp p", 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
4907
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 image that I've made with imagecreatefromjpeg. Here's the code:
7
5878
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
3864
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 boxs) .. data entry fields
2
1492
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 the answer by myself. Hopefully, someone will be able to give me some pointers :) First my background, I haven't programmed seriously in over 5...
137
6990
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 pragmatic - 3) I usually move forward when I get the gut feeling I am correct - 4) Most likely because of 1), I usually do not manage to fully explain...
11
3740
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 2003 Server or ADO or ODBC issue, I am posting this on all of the three newsgroups. That's the setup: Windows 2003 Server with IIS and ASP.NET...
13
40655
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 style="display:none"> can be displayed by setting the style attribute to "display:", or hidden with "display:none". This gives the illusion that the person...
99
6041
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 small or mid-sized business. ...
8
2047
by: Robert | last post by:
Hi, I can use "with" like this: function MyObject(message) { this.message = message; } function _MyObject_speak() {
24
2758
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> But I am curious about what techniques those of you who have done higher volume access implementations use to ensure high performance of the...
0
7605
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...
0
7917
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, 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. ...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7665
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...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
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
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.