Home > Archive > Unix Programming > February 2008 > g++ question
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| keith@bytebrothers.co.uk 2008-02-26, 8:32 am |
|
Hello,
Can someone please clarify for me whether g++ (v4.1.2, but generally
as well) supports the 'export' keyword? I can't find anything one way
or the other in the docs, but using 'export' as a variable name causes
weird errors!
Thx.
| |
| Martin York 2008-02-26, 7:23 pm |
| On Feb 26, 3:50 am, ke...@bytebrothers.co.uk wrote:
> Hello,
>
> Can someone please clarify for me whether g++ (v4.1.2, but generally
> as well) supports the 'export' keyword? I can't find anything one way
> or the other in the docs, but using 'export' as a variable name causes
> weird errors!
>
> Thx.
As I understand most C++ compilers do not support export [I have heard
on only 1 (not g++)](apparently it is very difficult to implement and
provides little benefit).
See a discussion here: http://www.thescripts.com/forum/thread60872.html
Also note that is a candidate for deletion from the standard
(recommended by Herb Sutter) I do not know if the recommendation has
been taken up.
So you are surprised that using a keyword as an identifier causes
problems.
That's just a bad idea. Just because it is not supported does not mean
the compilers don't treat it as a reserved word. I should think all
conforming compilers would not let you use a reserved word. Just my
opinion though.
| |
| keith@bytebrothers.co.uk 2008-02-27, 5:12 am |
| On 27 Feb, 00:46, Martin York <Martin.YorkAma...@gmail.com> wrote:
> On Feb 26, 3:50 am, ke...@bytebrothers.co.uk wrote:
[color=darkred]
> That's just a bad idea. Just because it is not supported does not mean
> the compilers don't treat it as a reserved word. I should think all
> conforming compilers would not let you use a reserved word. Just my
> opinion though.
Fair call. Thx.
| |
|
| On Feb 27, 4:22 am, ke...@bytebrothers.co.uk wrote:
> On 27 Feb, 00:46, Martin York <Martin.YorkAma...@gmail.com> wrote:
>
>
> Fair call. Thx.
FYI, g++ used to use export as a define to nothing, so using the
keyword export would led to really strange stuff:
in a template code, it is ignored and in code that inadvertently used
this keyword for variables declaration it would trigger a bunch of
weird syntax messages since things like "int export = 0;" would be
parsed as "int = 0;".
I saw that in one of the 3.x releases. With my g++ 4.2, export seems
to correctly processed though.
Cheers,
Paulo
|
|
|
|
|