First Program

This is a discussion on First Program within the C++ Programming forums, part of the General Programming Boards category; There is a standard that all compilers must abide by called the ANSI standard. This standard changes fairly regularly and ...

  1. #16
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,066
    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,317
    >> 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,317
    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
    xhi
    xhi is offline
    !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.

Page 2 of 2 FirstFirst 12
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, 12: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, 12:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 09:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

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