Thread: First Program

  1. #16
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    There is a standard that all compilers must abide by called the ANSI standard. This standard changes fairly regularly and with it changes syntax and other programming rules. Depending on how old the compiler is, it may or may not contain the correct, up to date rules that you know. Also, with non ANSI headers, such as conio.h, different companies (Borland, GNU, etc) will have different looking headers. This is why code may not compile on all compilers. As a standard, you should attempt to write your code as standard as you can so that non much has to be changed.
    Sent from my iPadŽ

  2. #17
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> This standard changes fairly regularly.

    Actually, there has been only one official C++ standard, at hasn't really changed much (a couple minor changes in technical corrigenda). That standard was approved in 1998, but it takes a long time for people to update their code, compilers, books, habits, etc. from pre-standard C++.

  3. #18
    <In Learning Mode>
    Join Date
    Dec 2004
    Posts
    6
    well i wrote some source code in college and it compiled fine using Visual C++ but then when i took it home and tried to compile it using Dev C++ i recieved errors and it wouldn't create the *.exe

    cant go into specific details as i cant remember the errors i got.

    would you recommend any good compilers?

  4. #19
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    The latest version of the Dev-C++ IDE is fine. You were probably using Visual C++ 6.0 which came out around the same time as the standard and is notorious for poor standards comformance. That means that many pieces of code that used to be acceptable no longer compile on modern compilers (like the one that comes with Dev-C++ or the latest Visual C++ compilers).

    Focus on using modern tools, books, compilers, tutorials, etc (i.e. those from the last couple years) and you shouldn't have much problem with old code no longer working.

  5. #20
    !anExpert
    Join Date
    Mar 2005
    Location
    pa
    Posts
    155
    Some books say it is good practice to make casts explicit rather than relying on implicit casts. Explict casts show you intended for the cast to happen.
    yeh, yeh. Youre right.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM