Question about compiler

This is a discussion on Question about compiler within the C++ Programming forums, part of the General Programming Boards category; I'm getting a wierd error I compile this code. Code: include "stdafx.h" using namespace System; struct phone { int AreaCode; ...

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    4

    Thumbs down Question about compiler

    I'm getting a wierd error I compile this code.
    Code:
    include "stdafx.h"
    
    using namespace System;
    
    struct phone
    {
    	int AreaCode;
    	int Exchange;
    	int Number;
    };
    
    
    int main(array<System::String ^> ^args)
    {
    	phone Phone2 = {999,999,0099};       //error occurs here
    
             phone Phone1 = {999,999,9999};       //works fine
    
        return 0;
    }
    The error message I get is error C2041: illegal digit '9' for base '8'. Is my complier messed up or something? Thanks.

  2. #2
    Registered User
    Join Date
    Jul 2006
    Posts
    14
    Numbers with leading zeroes are handling as octal (base 8). Obviously, there is no "9" in base 8 computations. Lose the leading zeroes or handle them as something other than numbers.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,855
    > int main(array<System::String ^> ^args)
    What kind of dope-induced brain damage is this?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    903
    That seems like managed C++ to me. *rolls eyes*

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,855
    Certainly looks s/man/dam/g to me
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about compiler copying objects
    By Sharke in forum C++ Programming
    Replies: 3
    Last Post: 06-15-2009, 09:25 AM
  2. gcc compiler question
    By s_ny33 in forum C Programming
    Replies: 6
    Last Post: 10-18-2005, 08:13 AM
  3. question about bool
    By ssharish2005 in forum C Programming
    Replies: 7
    Last Post: 10-17-2005, 09:18 AM
  4. C/C++ Compiler Question
    By Unregistered in forum C++ Programming
    Replies: 11
    Last Post: 07-09-2002, 03:09 AM
  5. Question: Which Compiler????
    By MaBo in forum C Programming
    Replies: 5
    Last Post: 06-04-2002, 12:57 PM

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