Though implementation problem

This is a discussion on Though implementation problem within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by (::) since you seem to be already having problems with gcc tell me do you also have ...

  1. #226
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by (::) View Post
    since you seem to be already having problems with gcc tell me do you also have this problem now or before

    why gcc would expect unqualified-id and what is that id
    Maybe if you posted the code that relates to that error message we could figure out what the problem is.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #227
    Banned
    Join Date
    May 2008
    Location
    Four Dots Planet
    Posts
    72
    Quote Originally Posted by matsp View Post
    Maybe if you posted the code that relates to that error message we could figure out what the problem is.

    --
    Mats
    yeah posted here

  3. #228
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    Code:
    return this->OperatorMinusMinusPost< /*CIteratorTmpl*/Iterators::CIterator<VecT, Proxy, Base> >();
    Gives me the errors:
    Code:
    error: expected primary-expression before '>' token
    error: expected primary-expression before ')' token
    ...with GCC, but compiles in Visual Studio.
    Why? I don't understand how GCC works or what it expects.

    OperatorMinusMinusPost is a member function inherited from the template base class. But it is also a template member function:
    Code:
    template<typename T> T OperatorMinusMinusPost();
    Anyone knows what the "correct" syntax is?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #229
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    What are Iterators, CIterator, and the three arguments?

    You might have to write

    return this->template OperatorM...
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #230
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    They are:
    Code:
    namespace Iterators
    {
    	// ...
    	template<typename VecT,
    	template<typename ProxyBase, typename Iterator, typename Type> class Proxy,
    	typename Base> CIteratorTemplate class CIterator:
    		public CIteratorBase<VecT, Proxy, Base>,
    		// ...
    And base:
    Code:
    namespace Iterators
    {
    	// ...
    	template<typename VecT,
    	template<typename ProxyBase, typename Iterator, typename Type> class Proxy,
    	typename Base> class CIteratorBase:
    		public std::iterator<std::random_access_iterator_tag, VecT>
    	{
    		// ...
    	protected:
    		// ...
    		template<typename T> T OperatorMinusMinusPost();
    I don't understand what syntax GCC is expecting.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #231
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Well, as I said, try
    Code:
    return this->template OperatorMinusMinusPost< /*CIteratorTmpl*/Iterators::CIterator<VecT, Proxy, Base> >();
    OperatorMinusMinusPost is a dependent name and it refers to a template, so you need the template keyword.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #232
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    Seems to work. Again, it seems VS's compiler is too advanced and too good for its own good, seeing as it can compile without those words.
    Last edited by Elysia; 05-18-2008 at 07:54 AM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #233
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Quote Originally Posted by Elysia View Post
    Seems to work. Again, it seems VS's compiler is too advanced and too good, seeing as it can compile without those words.
    "Too advanced and too good"?

    Well, perhaps. But I truly wish there was a way to switch it off and make it compile only strictly compliant code, so that such surprises wouldn't happen. In fact, since the compiler is able to compile the code without the help, it should be exceptionally good at pointing out where the typename and template keywords are missing.

    But to the best of my knowledge, there's no such option.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  9. #234
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,231
    Again, it seems VS's compiler is too advanced and too good, seeing as it can compile without those words.
    Troll.

    Soma

  10. #235
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    Quote Originally Posted by CornedBee View Post
    "Too advanced and too good"?
    Quote Originally Posted by phantomotap View Post
    Troll.
    Yes, as in VS's compiler is advanced enough to be able to compile code without those keywords.
    The standard requires them only to help with compiler implementation if I'm not mistaken.

    But, this is not a good thing, since it doesn't enforce nor warn about it.

    Well, perhaps. But I truly wish there was a way to switch it off and make it compile only strictly compliant code, so that such surprises wouldn't happen. In fact, since the compiler is able to compile the code without the help, it should be exceptionally good at pointing out where the typename and template keywords are missing.

    But to the best of my knowledge, there's no such option.
    There is a way, but unfortunately, Microsoft headers are full of extensions, so it won't compile without microsoft extensions. It's really a shame.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #236
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Which is just stupid. GCC has
    Code:
    #pragma GCC system_header
    which enables all extensions for the file even if they're disabled on the command line. Which makes sense, because it's completely absurd that the windows.h header doesn't compile if I set VC++ to strict compliance mode.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  12. #237
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    So very true and I wish it were so, but I have absolutely NO way of progammatically enabling and disabling extensions.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #238
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,231
    Yes, as in VS's compiler is advanced enough to be able to compile code without those keywords.
    No. It isn't. It may appear that way, but in reality it is an artifact of a broken compiler. This artifact wasn't accomplished with intent; it wasn't done to make users lives easier.

    The standard requires them only to help with compiler implementation if I'm not mistaken.
    The standard requires them because the C++ language has several ambiguous uses leading to confusion or wrong results. Without the 'template' keyword the statement is wrong because the statement can be interpreted as a much more complex statement that is missing an element.

    There is a way, but unfortunately, Microsoft headers are full of extensions, so it won't compile without microsoft extensions. It's really a shame.
    This is a nonsensical reason. They use 'pragma' everywhere to turn off and on other warnings and errors. They didn't do it because supporting broken code is not something they want to do.

    Soma

  14. #239
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    Quote Originally Posted by phantomotap View Post
    No. It isn't. It may appear that way, but in reality it is an artifact of a broken compiler. This artifact wasn't accomplished with intent; it wasn't done to make users lives easier.
    So you say. I don't agree.

    The standard requires them because the C++ language has several ambiguous uses leading to confusion or wrong results. Without the 'template' keyword the statement is wrong because the statement can be interpreted as a much more complex statement that is missing an element.
    But all code compiles fine in VS. Apparently, it compiles the correct code.

    This is a nonsensical reason. They use 'pragma' everywhere to turn off and on other warnings and errors. They didn't do it because supporting broken code is not something they want to do.
    It's not nonsense. Compile the headers without extensions and you'll get loads of compile errors.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  15. #240
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,231
    So you say. I don't agree.
    Which is irrelevant; the accounts are in the history.

    But all code compiles fine in VS. Apparently, it compiles the correct code.
    It only compiles as you apparently want it to be compiled. A conforming compiler will interpret that statement as missing a key element because the standard says it is missing an element.

    It's not nonsense. Compile the headers without extensions and you'll get loads of compile errors.
    It is nonsense.

    1): Nothing is stopping them from supporting C and C++ correctly.

    2): As I've said, they use 'pragma' everywhere to turn off and on other warnings and errors.

    Edit: "They didn't do it because supporting broken code is not something they want to do." Just to clear that up: they want to support the existing code base, but not new broken code.

    Soma
    Last edited by phantomotap; 05-18-2008 at 08:23 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  2. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 05:24 PM
  3. implementation file
    By bejiz in forum C++ Programming
    Replies: 5
    Last Post: 11-28-2005, 12:59 AM
  4. Replies: 5
    Last Post: 11-07-2005, 10:34 PM
  5. Memory Problem - I think...
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 10-24-2001, 12:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21