473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Another "is this C++" question for the language lawyers

template <class CharT >
struct ctype_byname {
ctype_byname();
};
template < >
ctype_byname<char>::ctype_byname<char>();

This code compiles with GCC 3.4.4, Sun CC 5.8, and MSVC 7.1. It fails
to compile with GCC 4.1.1, Intel CC 9.1, and Comeau's online compiler.

So... who's got it right?

My hunch from the fact that GCC used to accept it and now doesn't, plus
the fact that Comeau rejects it, is that it's probably not legal, but
can anyone verify this?

I've got a copy of the standard, so feel free to cite it if you happen
to look there anyway, but I have no clue where to look really. (I read
through 14.7 but to no avail. I wonder if maybe there's something
relating to this with all the blah-ids in 14.7.2 para 2, but I don't
know the standard well enough to make that determination.)

Thanks,
Evan

Dec 5 '06 #1
1 1250
Evan wrote:
template <class CharT >
struct ctype_byname {
ctype_byname();
};
template < >
ctype_byname<char>::ctype_byname<char>();

This code compiles with GCC 3.4.4, Sun CC 5.8, and MSVC 7.1. It fails
to compile with GCC 4.1.1, Intel CC 9.1, and Comeau's online compiler.

So... who's got it right?

My hunch from the fact that GCC used to accept it and now doesn't, plus
the fact that Comeau rejects it, is that it's probably not legal, but
can anyone verify this?
The code is close to legal, but not quite: the constructor that you try to
specialize is not a member template. Thus, you need to lose the second
template parameter:

template <class CharT >
struct ctype_byname {
ctype_byname();
};

template < >
ctype_byname<char>::ctype_byname();

[snip]
Best

Kai-Uwe Bux
Dec 5 '06 #2

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

Similar topics

6
by: Sandman | last post by:
I want to do this: function square ($a){ print "-- $a --"; } And use it like this: <? square( ?> Hello! <? ) ?> And get this:
5
by: JKop | last post by:
You can overload the address-of operator. Consider a simple class: class Blah { public: Blah* operator&() { return this; }
0
by: Chris Albertson | last post by:
I do the following as the user "postgres" alberts=# CREATE FUNCTION foobar(CSTRING) alberts-# RETURNS opaque alberts-# AS '$libdir/mystuff' , 'foobar' alberts-# LANGUAGE 'c' alberts-#...
7
by: Christopher Murtagh | last post by:
Greetings, I just had to dump and restore one of my DBs (7.4RC2), and I got an interesting message. I first did: pg_dump dbname > db_restore.sql Then at console did the following:
1
by: perper | last post by:
Cannot use 'jscript' because another language has been specified earlier in this page I tring to# include an JScript file into a ASp.net in order to use functions declared in ti on the server...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
37
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as...
92
by: ureuffyrtu955 | last post by:
Python is a good programming language, but "Python" is not a good name. First, python also means snake, Monty Python. If we search "python" in google, emule, many results are not programming...
8
by: howa | last post by:
Just found a funny things.. in HTML4's dtd, http://www.w3.org/TR/html4/strict.dtd language is not valid, i.e. <!ELEMENT SCRIPT - - %Script; -- script statements --> <!ATTLIST...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.