Thread: Question about compiler

  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
    39,660
    > 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.

  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
    39,660
    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.

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, 08:25 AM
  2. gcc compiler question
    By s_ny33 in forum C Programming
    Replies: 6
    Last Post: 10-18-2005, 07:13 AM
  3. question about bool
    By ssharish2005 in forum C Programming
    Replies: 7
    Last Post: 10-17-2005, 08:18 AM
  4. C/C++ Compiler Question
    By Unregistered in forum C++ Programming
    Replies: 11
    Last Post: 07-09-2002, 02:09 AM
  5. Question: Which Compiler????
    By MaBo in forum C Programming
    Replies: 5
    Last Post: 06-04-2002, 11:57 AM