can anyone tell me what gcc is?? and wts are its advantage over other compiler like turbo c and visual c
The GNU Compiler Collection is an open source (GPL) compiler. It's found on a wide variety of systems, ranging from GNU/Linux to every flavor of Unix, to Windows.
GCC contains support for many languages (C, C++, Fortran, to name but a few). It's highly portable, and widely used, and tends to produce good code. It can also be used as a cross-compiler (compiling for a system other than the one running GCC).
It's the default compiler choice for most Unix-type systems because most vendors don't bother to write their own compilers anymore - GCC is just too good for general use.
Under Windows, Microsoft's own dev tools are often preferred because they get support for new technologies quicker.
In high-performance programming environments (and some embedded environments) you may want a compiler that's more highly tuned to the chip/system in question.
The GNU Compiler Collection are the compilers used in GNU/Linux systems. I don't know that they compete with Turbo C or Visual C, which I think only run on DOS/Windows systems.
The main advantage to a user is that GCC can be installed on (and is sometimes distributed with) nearly every GNU/Linux system and can be used to build packages that are distributed as source.
I'm sure there are advantages that programmers would recognize, but maybe that's a topic for stackoverflow.com.
[Edit]
Now that this question has been migrated, see Michael Kohne's answer for some advantages to programmers.
Big advantage of gcc over Turbo C and Visual C: it's free!*
And it's ubiquitous, especially on the various *nix environments. You can use it on Windows via either cygwin or MinGW. It compiles a truly staggering number of languages (C, C++, Ada, Java, Fortran, Objective-C), and supplies an intermediate language for Haskell.
It has been used for industrial-strength projects for decades now, so you're pretty safe with it.
*(Though, in all fairness, Microsoft does offer Visual C++ Express for free, though it is not open source.)
The real true advantage of gcc over turbo C and visual C is it's availability on platforms other than Windows, and it's ability of building cross-platform binaries, meaning you can set up a build tool chain to build windows binaries on a linux box with gcc, or you can set up a similar tool chain to build some arm binaries on an intel box, which is definitely nice since you might not have as much power in your arm device as you might have in you development rig. With visual c compiler and turbo c compiler that's close to impossible.
A nice bonus to all that - gcc is open source and free.
Whereas GCC started as GNU C Compiler, it is now GNU Compiler Collection, as it has compilers for C, C++, Java, Fortran among others. Why would you want to use it? Because its better. Better, because:
Once you have written your code using the GCC compilers, you are assured that your code will work on a lot of other OSs/platforms/architectures. You will be able to do a lot more in and with your programs than you would do in Turbo C, which is pretty much tied to Windows.
GCC is used by all of those projects out there in the wild. Having some experience with GCC is definitely a great plus when you are moving to some serious programming.
and its just good karma :)
The GCC collection is open source. This allows it to be ported to MANY different platforms rather quickly because so many people work on it and have seen how it works. Commercial compilers usually are closed-source, and such only one company or consorsium can do the porting, which can be time-consuming.
Related
This is a a question in my head for some years, I am using OCaml under windows, when I build each OCaml distribution version, I need a C compiler, either MSVC or MingGW, and I have to do it under Cygwin.
When I have my OCaml in hand, and when I need to compile my codes, I also need the c linker that I used for compiling my OCaml..for me it's very strange. Why OCaml can't auto bootstrap with an elder version of OCaml instead of some C compiler?
The OCaml toolchain relies on external tools to assemble and link binaries. The latter is probably more important than assembler, as assemblers are more or less stable. But linkers are usually deeply integrated with an operating system and differ each version. Bundling them will increase support burden and make OCaml programs less portable and the whole OCaml distribution more fragile. So, depending on assembler/linker abstraction is sort of a sweet point, that minimizes dependencies and support burden and maximizes portability.
Other languages, usually, follow the same approach. Even those that depend on LLVM, as LLVM actually uses the GNU toolchain linker underneath the hood.
For building OCaml itself, the C compiler is absolutely necessary. The OCaml itself is not written entirely in OCaml. In fact, OCaml runtime is written in pure C, e.g., garbage collector. Also, many functions, especially that define system interface (e.g., Unix) are also written in C. The sloccount tool gives us a rough estimate, that 15% of OCaml source code (45,000 LOC) is written in C.
The OCaml bytecode interpreter is written in C - see the description in the OCaml README here.
ivg's answer says it all, but I'll just give a quick tip for Windows 10 users.
I always recommend that Windows 10 users use Ubuntu on Windows 10. You'll then have access to a fully-fledged Unix environment instead of Cygwin, which include (among other things) a built-in C tool chain.
I'd only use Windows to develop if I intend to release on Windows, which I rarely do. Even then, I'd prefer to use a cross-compiler and use Windows only for testing.
I'm writing a teaching tutorial to teach university students and programming enthusiasts Compilation concepts on an x86.
I want an IDE tool like WinASM for them to be able to debug their work, but am aware that they may not all run Windows at home.
Is my best choice to target Jasmin? (Or have you got a better suggestion - and why?)
Another approach I've seen is to use a common teaching architecture (such as MIPS) and run it under emulation. For MIPS in particular, there are lots of interactive simulators (like SPIM), as well as full system emulators (like QEMU). The fact that the MIPS architecture is considerably simpler (and less register-starved!) than x86 is definitely a plus as well -- it means you can spend more time focusing on interesting compilation topics, rather than teaching the architecture.
This is another approach (although poor for debugging) - executing assembler inline in C++
A C repl that generates ASM - for learning about the assembler generated.
Also you could just rely on old gdb.
Have you ever considered an online debugging tool? There are a few of them out there. I personally like this asm debugger.
I see many Fortran compilers available for Windows:
NAG
Absoft
Portland Group
Lahey
Intel
OpenWatcom (F77 only)
Silverfrost FTN95
Pathscale
GNU/GCC
GnuFortran
If I've missed any, feel free to edit this post.
I'd like to use at least Fortran 95, and possibly Fortran 2003. What are the differences among the compilers above?
(GCC:
Generic front-end
GnuFortran: Fortran front-end)
If I've missed any, feel free to edit this post.
You definitely missed GNU Fortran compiler (for Windows you can get binaries from this site).
I'd like to use at least Fortran 95, and possibly Fortran 2003.
Just to alert you from the very beginning - forget about full Fortran 2003 support. Fortran 2003 status.
What are the differences among the compilers above?
Different prices, different platform (OS) support, different list of extensions to the standard language, different (empty) list of supported Fortran 2003 features, some additional features (i.e., Portland Group has special CUDA compiler, different optimization capabilities.
Fortran Compiler Comparisons.
As with other kinds of software the main differences would be;
- their development status in regards to Fortran standard support
- support from dev. and support crew (in this regard I've been very satisfied with Intel's) at my old workspace ... their forum is a great place for seeking advice, and their crew is very helpful
- price ...
In the end, when choosing a compiler, it most often comes down to what compiler line you used on present codebase (for example - MS Powerstation -> Digital's -> Compaq's Visual Fortran -> Intel's ...). Apart from the standard almost all compilers come with various custom extensions of their own, graphical libraries and so on, and this often is the choosing factor.
I'd like to use at least Fortran 95, and possibly Fortran 2003. What are the differences among the compilers above?
Fortran 95 is supported by all of them, I think (not having the time to check it now, but fairly certain), and a lot of them is quite good on supporting F2008 features. However, F2008 is a minor standard upgrade to F2003, which was a major standard upgrade, and so a lot of them is still not supporting all F2003 features (it will be some time yet before they do that, btw). For example, Intel's as of recent started claiming support for co-arrays, a lot awaited feature of many users.
Therefore, at current there is no F2003 (apart from Cray's maybe, but they're not available on Windows platform) standard compilant compiler, and certanly no F2008 standard compilant compiler since they would have to have full support for 2003 and 2008 to be able to claim that. It is a little complicated story to go in now.
However, in the one #kemiisto gave and there are others as well, you can check for individual features you need and based on that choose which compiler supoorts your demands.
Hope some of this makes sense.
MSYS and UNIX-like build systems apart; why does Mingw exist? What I mean is, why isn't win32/64 just another target available in "vanilla GCC"? Are there technical reasons for this or are they "political"? It would seem to me that there isn't really anything special about the Windows platform that would make a GCC port to it "incompatible" with the original GCC.
Mingw isn't just the compilers - it's also the libraries and headers (and whatever other support files you might need).
GCC is just a compiler. Mingw is a full environment.
MingW is intended to allow easy porting of Posix apps to windows. It's simply a "thinner" layer than CygWin, so not everything might work where windows too different. CygWin allows provides enough insulation that even the scripting tools to build and generate code run.
Edit:
Microsoft is very fond of making there own standards, and want to put there own brand on things for which open standards already exist. i.e. OpenGL -> DirectX, Java -> .net, OpenCL is the next standard they want to spurn. This makes them a bit of a pain for non sponsored project to support them as a target. They have always turned away from anything that allows easy cross platform development, because they only want you to develop your app for there OS. It's a marketing strategy, control the brand, control the platform, and make it painful for people to support other OSes. MingW is required because GCC can generate x86 code, but even the most basic runtime support is different than Posix based OSes.
well, while you can use cross compiler to produce win32/64 binary codes from GCC, someone has to port all the C runtime libraries across though. Both Mingw and Cygwin are created for this purpose.
From MinGW's main site
Offered in easily installed binary package format, for native deployment on MS-Windows, or user-built from source, for cross-hosted use on Unix or GNU/Linux, the suite exploits Microsoft's standard system DLLs to provide the C-Runtime and Windows API.
Note: I know very little about the GCC toolchain, so this question may not make much sense.
Since GCC includes an Ada front end, and it can emit ARM, and devKitPro is based on GCC, is it possible to use Ada instead of C/C++ for writing code on the DS?
Edit: It seems that the target that devKitARM uses is arm-eabi.
devkitPro is not a toolchain, compiler or indeed any software package. The toolchain used to target the DS is devkitARM, one of the toolchains provided by devkitPro.
It may be possible to build the ada compiler but I doubt very much if you'll ever manage to get anything useful running on the DS itself. devkitPro will certainly never provide an ada compiler as part of the packages we produce.
Yes it is possible, see my project https://github.com/Lucretia/tamp and build the cross compiler as per my script. You would then be able to target NDS using Ada. I have build a basic RTS as well which will provide you with local exception handling.
And #Martin Beckett, why do think Ada is aimed squarely at DoD stuff? They dropped the mandate years ago and Ada is easily usable for any project, you do realise that Ada is a general purpose programming language don't you?
(Disclaimer: I don't know Ada)
Possibly.
You might be able to build devKitPro to use Ada, however, the pre-provided binaries (at least for OS X) do not have Ada support compiled in.
However, you will probably find yourself writing tons of C "glue" code to interface with the various hardware registers and the like.
One thing to consider when porting a language to the nintendo DS is the relatively small stack it has (16KB). There are possible workarounds such as swapping the SRAM stack content into DRAM (4MB) when stack gets full or just have the whole stack in DRAM (assumed to be auwfully slow).
And I second Dre on the fact that you'll have to provide yourself glue between the Ada library function you'd like to use and existing libraries on the DS (which are hopefully covering most of the hardware stuff).
On a practical plane, it is not possible.
On a theoretical plane, you could use one custom Ada parser (I found this one on the ANTLR site, but it is quite old) in order to translate Ada to C/C++, and then feed that to devkitpro.
However, the effort of building such translator is probably going to be equal (if not higher) to creating the game itself.