Topic: Two standards questions
Author: Mathew G Monroe <mmex+@andrew.cmu.edu>
Date: 1995/10/14 Raw View
First: Under the current draft standard are all const object only given
an internal linkage, unless they have previously been given external
linkage? I ask because I understood this was the case. But, GNU G++
(at least 2.7.0) doesn't strictly follow this. For example,
const char *messages[]={"Fun", "Stuff};
const char fun[]="message";
messages is made external, and fun is internal. This seems wrong to me,
both should be internal.
Second: By the current standard is the complex class a template? I ask
because old versions of GNU g++ and libg++ has complex not as a
template, yet g++ 2.7.0 and libg++ 2.7.0 make it a template.
Thanks,
matt
------
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1995/10/14 Raw View
In article 4kTmzbC00iVD0Bmn4x@andrew.cmu.edu, Mathew G Monroe <mmex+@andrew.cmu.edu> writes:
>
>First: Under the current draft standard are all const object only given
>an internal linkage, unless they have previously been given external
>linkage? I ask because I understood this was the case.
Yes.
> But, GNU G++
>(at least 2.7.0) doesn't strictly follow this. For example,
>
>const char *messages[]={"Fun", "Stuff};
>const char fun[]="message";
>
>messages is made external, and fun is internal. This seems wrong to me,
>both should be internal.
No, GNU is correct. "messages" is not const, so it is made external.
That is "messages" is a non-const pointer to a const char. On the
other hand, "fun" is a const array of chars. The "const" applies to
the declarator which follows. In the first case, the declator is "*"
and in the second case it is "fun". Pointers and arrays are not
the same thing.
>
>Second: By the current standard is the complex class a template? I ask
>because old versions of GNU g++ and libg++ has complex not as a
>template, yet g++ 2.7.0 and libg++ 2.7.0 make it a template.
Yes, the current draft makes complex a template. The exact spelling
of the names and whether the spelling "complex" should be a typedef
to something like basic_complex<double> instead of the name of a
template was still under discussion the last time I checked.
---
Steve Clamage, stephen.clamage@eng.sun.com
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]