Jump to content

Compiler Differences

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
DevilsCharm

DevilsCharm

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 884 posts
How come there are so many different compiles for C++? Also, it seems like you need to code differently for different compilers. One time I wrote a code that worked on one compiler and not on another. Why is that? Wouldn't that cause a lot of problems when sharing programs?

#2
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
Different compilers use different ways to interpret and compile the sourcecode. It's like browser and their way to show the HTML visually for the user.
Normally, when you make bigger projects, or similar, you make a makefile for as many compilers as possible. Then the user can choose which of the makefiles to use, depending on the user's compiler.

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
In addition, C++ is not a fixed or simple object. C++ started as a private project in Bell Labs, then it became an ISO/ANSI standard. It has been through a few revisions since then. AFTER a standard is set, it is up to the various compiler creators to adjust the compiler to implement the various elements of the standard are implemented.

One thing that I ran into was when something that was legal C++ became illegal. I had an older compiler that would run the (newly) illegal code, and a newer one that wouldn't. When the standard changes, you have to be careful about updating the compiler, as it could break TONS of old code that used to be legal.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
G_Morgan

G_Morgan

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 537 posts
C++ is huge. There was an article on Reddit today about how the C++ template language is Turing equivalent by accident*. There aren't any compilers that are fully compliant to the standard AFAIK but I might be wrong.

There aren't any fully compatible C99 compilers yet and C99 is a far less complex beast than C++.

*this simply means it can solve any finite algorithm that can be defined and thus is able to solve the problem set of any other language in existence.