Subject: Re: c++
To: None <tech-toolchain@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-toolchain
Date: 09/18/1998 20:05:41
> Meanwhile, here's a surprising code snippet:
> #include <iostream>
> #include <string>
>
> int main()
> {
> int _B=10;
>
> cout<<_B<<endl;
>
> return 0;
> }
> Try g++ -E on it, and view the output. With #include <string>, the
> _B is changed to 0x80.
In C, _B would be in implementation namespace, and thus attempting to
use it for a user variable is liable to produce, um, arbitrary
surprises.
I don't know whether there's a C++ standard or not, and if there is
whether it specifies anything similar. If so, this is programmer
error; if not, it's arguably a bug in the C++ <string> include -
probably due to including ctype.h, with its _B, _P, etc, macros.
der Mouse
mouse@rodents.montreal.qc.ca
7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B