Code::Blocks doesn't like my enums and typedefs

This is a discussion on Code::Blocks doesn't like my enums and typedefs within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by laserlight Which version of MSVC did you use? I suggest testing with this: I was using Microsoft ...

  1. #16
    Registered User
    Join Date
    Oct 2005
    Posts
    14
    Quote Originally Posted by laserlight View Post
    Which version of MSVC did you use? I suggest testing with this:
    I was using Microsoft VC++ Express 2005 with SP1.

  2. #17
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,796
    That is very weird. We are essentially using the same compiler with compiler extensions turned on, but the results are different. Have you checked with my test program?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #18
    Registered User
    Join Date
    Oct 2005
    Posts
    14
    Actually I'll have to reboot to do that but i'll give it a shot. brb

  4. #19
    Registered User
    Join Date
    Oct 2005
    Posts
    14
    Code:
    #include <iostream>
    
    int main()
    {
        std::cout << sizeof int << std::endl;
    }
    I received the compiler error for this like expected. Then I modified it for a typedef:

    Code:
    #include <iostream>
    
    typedef int int32;
    
    int main()
    {
        std::cout << sizeof int32 << std::endl;
    }
    And it compiled without error using VC++ Express 2005.

    This has been fun, bit of a mind boggle huh

  5. #20
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,796
    Thanks, I can confirm that. Since the behaviour remains the same even with compiler extensions turned off, I conclude that this is an area where the compiler simply does not conform to the standard.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

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