473,653 Members | 3,000 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 1370
In article <11************ **********@y80g 2000hsf.googleg roups.com>,
<gi*@waves.comw rote:
>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.co mwrote in message
news:13******** *****@corp.supe rnews.com...
In article <11************ **********@y80g 2000hsf.googleg roups.com>,
<gi*@waves.comw rote:
>>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
10144
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 any references to it in the official PHP documentation (many times in the user contributed notes, though). Often, undocumented features go away with future releases, since "nobody should have been using them anyway," etc. For this reason I am...
4
3415
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) Encoding1.GetChars(string1); Encoding1.GetChars(arrayofbytes1);
0
2495
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 results under 9.2.0.4. The queries all involve functions, including built-in functions like NVL. The strangeness is that less than the expected number of rows is returned *or* and ORA-01422 is generated. Here's an example:
2
1766
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: We have a web page (written in ASP, if that's relevant) on which we accept enrollment information.
12
4748
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 (N.act_recov_date IS NOT NULL) BEGIN ATOMIC select count(*) into v_n from is3.flushes
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 the ASCII encoding as some have suggested. The undocumented truth is, Microsoft uses the Western European encoding in these functions. If you don't believe me, use 137 in your VB Chr function then compare the C# output if you just cast it or...
1
2188
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 they host. The app was created with VS.NET v.7. And the server is running Windows 2000 Advanced Server.
33
2850
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 (tried: visual studio 2005 + linux/macintosh gcc)... That's a pretty good thing. I think the error still appears using both gcc and visual studio 2005. Everything is standard C (ANSI C ?? I don't know the difference) - but since so many functions...
1
1443
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 of interface in the future? I looks unlikely, since pkgutil is used in setuptools, but I want to be sure before relying on it. Michele Simionato
0
8370
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8283
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8704
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8590
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7302
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5620
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4147
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2707
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
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.