Question:
How does one compiler differ from another?
Dino
2012-07-20 17:14:42 UTC
I know that IDEs differ (they are like the gui)
on the other hand (compilers, Linkers...)
should all do the same thing shouldn't they?

lets say a c++ compiler
"does it really matter which I use"

the reason I ask this is because I have had some errors switching from one IDE to another before
I don't know why

mingw looks decent
don't mean to sound like a git, but clarification would be appreciated
Three answers:
husoski
2012-07-20 19:36:06 UTC
For standard C++, it shouldn't matter. However, it's easy to make assumptions that are not part of the language...and which may differ from one compiler to the next.



Sometimes, it's not the programmer's fault. Not the first time, anyway. Visual C++ Express has a quirk that if you create a project as a "C++>Win32 Console Application", you get started with a "hello MS world" main program that will *only* compile on Visual C++, and won't compile if you wipe everything out and replace it with a legitimate C++ main function. Best is to delete the project and start over with an Empty Project.



GNU C++ allows C99 variable length arrays, even though they are not part of even the latest C++ standard (2011). You can prevent that with a --pedantic compiler switch, but that's not the default setting. You could import a modern C source, fix up the C vs. C++ differences to get a working program under G++, but won't compile in VC++.



Some things are just not defined by the language. The following bit of weirdness:



!(cout << "left ") | !(cout << "right ");



is perfectly standard, but may output "left right " on one compiler, and "right left " on another. C++ does not specify the order in which arguments to a binary operator are evaluated. Either way, or even "lrieghf t " is possible.



I have developed a habit of (a) turning off compiler extensions, and (b) turning on all warnings. Then I make sure that each source compiles without warnings. As a self-check, I'll take all or part of a project and compile it on another compiler, just to get another set of checks. As time goes on, the number goes down, but I still find myself unintentionally producing non-portable code.



So, if you have problems moving code from one compiler to another, check your own code for portability.



MinGW isn't an IDE, by the way, but it is the best windows native port of the GNU compilers and related tools. You can use the MinGW "toolchain" with IDEs like Code::Blocks, DevC++, Eclipse and NetBeans.
2012-07-20 18:54:48 UTC
Yes, some Compilers use different standards for example some C++ compilers use the ASCII Standard while others use "Standard C++" the differences are slight but can cause fatal error if not addressed. Such us leaving out a return in the main function. In one standard the return is automatically added if you forget it, while in the other a fatal error will occur.
2017-01-14 12:04:03 UTC
A extreme-point programming language progressed via solar Microsystems. Java became initially referred to as OAK, and became designed for hand-held units and set-good packing containers. o.ok.became unsuccessful so in 1995 solar replaced the call to Java and changed the language to take income of the burgeoning international-extensive-information superhighway. Java is an merchandise-orientated language comparable to C++, yet simplified to do away with language good factors that reason effortless programming blunders. Java source code information (information with a .java extension) are compiled right into a format referred to as bytecode (information with a .classification extension), that could then be accomplished via a Java interpreter. Compiled Java code can run on maximum computers simply by fact Java interpreters and runtime environments, prevalent as Java digital Machines (VMs), exist for many working platforms, inclusive of UNIX, the Macintosh OS, and domicile windows. Bytecode can be converted straight away into device language instructions via a merely-in-time compiler (JIT). Java is a accepted purpose programming language with countless good factors that make the language properly desirable for use on the international-extensive-information superhighway. Small Java purposes are referred to as Java applets and can be downloaded from a information superhighway server and run on your computing gadget via a Java-properly suited information superhighway browser, consisting of Netscape Navigator or Microsoft information superhighway Explorer. Have a blessed day!


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...