473,503 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A mysterious undocumented keyword?

gil
Hi,

In VS 2005 (SP1), the following code does not compile:

=============
typedef int _sptr ;
_sptr p = 1;
=============

the compiler emits the following:

source1.cpp(1) : warning C4091: 'typedef ' : ignored on left of 'int'
when no variable is declared
source1.cpp(2) : error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int

After pulling half my hair out, I found that changing _sptr to almost
anything else (e.g. _sptr1), makes the code compile. Note that:
1. _sptr is not mentioned anywhere in the MSDN database.
2. I suspect that this didn't happen to me before upgrading my VS2005
to SP1.
3. Removing the '_' made the word 'sptr' change to blue as if a
keyword, again, sptr isn't mentioned in MSDN. (this happened on one
PC, on another it didn't).

Can anyone please help, what is _sptr?

Thanks,
Gil Moses.

Apr 30 '07 #1
3 1362
In article <11**********************@y80g2000hsf.googlegroups .com>,
<gi*@waves.comwrote:
>typedef int _sptr ;
Anything starting with an _ is reserved for the compiler. See
http://www.mail-archive.com/cy****@c.../msg78723.html , or
http://www.mozilla.org/hacking/porta...reserved_names
which quotes the C++ spec, section 17.4.3.1.2. Yes, a whole lot of
existing code violates this. No, this is not flagged as a warning,
though I think it should.

Short summary: you're violating C++ standards with your code
above. As you've already discovered, other names work. Use them.
Don't try to cry conspiracy or "hidden keyword" about _sptr, just do
the right thing and avoid leading underscores.

Nathan Mates
--
<*Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Apr 30 '07 #2
gil
Thanks Nathan for the enlightment.

Gil.

May 1 '07 #3

"Nathan Mates" <na****@visi.comwrote in message
news:13*************@corp.supernews.com...
In article <11**********************@y80g2000hsf.googlegroups .com>,
<gi*@waves.comwrote:
>>typedef int _sptr ;

Anything starting with an _ is reserved for the compiler. See
http://www.mail-archive.com/cy****@c.../msg78723.html , or
http://www.mozilla.org/hacking/porta...reserved_names
which quotes the C++ spec, section 17.4.3.1.2. Yes, a whole lot of
existing code violates this. No, this is not flagged as a warning,
though I think it should.

Short summary: you're violating C++ standards with your code
above. As you've already discovered, other names work. Use them.
Don't try to cry conspiracy or "hidden keyword" about _sptr, just do
the right thing and avoid leading underscores.
It's still reasonable to ask what the keyword does, especially if the editor
is highlighting "sptr" (no underscore) as a keyword.
>
Nathan Mates
--
<*Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A.
Heinlein

May 3 '07 #4

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

Similar topics

4
10132
by: Joshua Beall | last post by:
Hi All, I've seen many references to the $_SERVER variable, which is set to the string 'on' when the client is connected via HTTPS rather than regular HTTP. However, I have been unable to find...
4
3402
by: Viorel | last post by:
For me is a little bit mysterious how work encoding and decoding functions, what is underneath of their calling? Encoding1.GetBytes(string1); in particularly ASCII.GetBytes(string1) ...
0
2487
by: SteveS | last post by:
Can anyone help with a mysterious problem that has arisen since 'upgrading' from 8 to 9.2.0.4? The situation is this: Queries that worked fine under 8 are now producing *really* strange...
2
1762
by: M Wells | last post by:
Hi All, I'm trying to track down a mysterious problem we're experiencing in which updates and inserts to tables in our mssql2k server appear to be 'disappearing.' To explain our situation: ...
12
4737
by: Bob Stearns | last post by:
I am trying to create a duplicate prevention trigger: CREATE TRIGGER is3.ard_u_unique BEFORE UPDATE OF act_recov_date ON is3.flushes REFERENCING NEW AS N FOR EACH ROW MODE DB2SQL WHEN...
0
737
by: Darrell Sparti, MCSD | last post by:
There have been many postings about this subject on this newsgroup. Unfortunately, they're incorrect. You can't just cast a value in C# and have it work for all ASCII characters. Nor can you use...
1
2179
by: Bruce W.1 | last post by:
BACKGROUND My ASP.NET app has been running (or rather available) on a server for about 4 months now. The server is at http://www.webhost4life.com/ They don't add cookies to any of the sites...
33
2826
by: Martin Jørgensen | last post by:
Hi, In continuation of the thread I made "perhaps a stack problem? Long calculations - strange error?", I think I now got a "stable" error, meaning that the error always seem to come here now...
1
1437
by: Michele Simionato | last post by:
I see that the pkgutil module has many useful functions which are however undocumented. Does anybody know why it is so? In particolar, can I safely use pkg.walk_packages without risking a change...
0
7199
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
7074
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
7322
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...
1
6982
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
7451
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...
0
4667
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...
0
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1501
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 ...

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.