Questions tagged [gcc]

GCC is the GNU Compiler Collection. It's the de facto standard C compiler on Linux and supports many other languages and platforms as well.

GCC is the GNU Compiler Collection, a collection of free software compilers. It is a key component of the GNU Toolchain.

GCC includes a C compiler that is the standard C compiler on Linux. GCC also includes front ends for C++ (including a large amount of experimental support for C++11), Objective-C, Fortran, Java, Ada, and Go, as well as libraries for these languages (libstdc++, libgcj,...). It supports many architectures.

GCC sources available via SVN repository. Major decisions about GCC are made by the steering committee, guided by the mission statement.

See also GCC online documentation.

40 questions
282
votes
7 answers

How to write a very basic compiler

Advanced compilers like gcc compile code into machine readable files according to the language in which the code has been written (e.g. C, C++, etc). In fact, they interpret the meaning of the code according to library and functions of the…
Googlebot
  • 3,173
  • 5
  • 19
  • 14
63
votes
9 answers

Novice programmer(s) frustrated by lack of a glossary of compiler errors

A friend of my family asked me for a bit of help as he learns to program (in the C language). As we were talking, he expressed frustration about having a hard time understanding the error messages his compiler (GCC) is giving him when he makes…
einpoklum
  • 2,478
  • 1
  • 13
  • 30
31
votes
3 answers

Is GCC dying without threads support on Windows?

I need some opinion. GCC was always a very good compiler, but recently it is losing "appeal". I have just found that on Windows GCC does not have std::thread support, forcing Windows users to use another compiler because the most exciting feature is…
CoffeDeveloper
  • 551
  • 1
  • 4
  • 10
26
votes
4 answers

GCC vs clang/LLVM -- pros and cons of each

What are the pros and cons of GCC vs clang/LLVM?
yodie
  • 694
  • 1
  • 7
  • 12
23
votes
5 answers

Whether to use -pedantic flag in g++ or not?

I'm learning C++ and I'm using g++ on Linux for practicing. I want to know if people working as programmers use g++ -pedantic flag and also its importance in real world. What about other compilers, do they also allow this? Has this become some…
user803563
  • 397
  • 1
  • 2
  • 7
19
votes
2 answers

Why glibc is maintained separately from GCC?

GCC is the C compiler. Glibc is the C library. However, isn't it an absolute necessity for a compiler and the standard library bundled together as a C implementation? For example, the C library contains ABI and compiler specific stuff like…
Michael Tsang
  • 810
  • 2
  • 7
  • 13
13
votes
3 answers

Isn't there a chicken-and-egg issue since GCC is written in C++ itself?

Since 4.8 release, the C++ compiler GCC (the G++ part of it) is written not in C anymore, but in C++ itself. I have a hypothetical question on this. I wonder how to compile the C++ code of GCC on a new platform that has no C++ compiler yet. Of…
danijar
  • 826
  • 1
  • 10
  • 16
12
votes
6 answers

Is there a way to use gcc as a library?

Anyone knows a solution that works something like this: #include #include /* This .h is what I'm looking for. */ int main (void) { /* variables declaration (...) */ /* The following line is supposed to be equivalent to: …
WhyWhat
  • 223
  • 1
  • 6
11
votes
2 answers

Why C allows multiple global declarations of the same variable but NOT multiple local declarations?

I noticed that if I declare a global variable multiple times the compiler does not even output a warning. However if I declare a local variable in a function multiple times, for example, the gcc compiler outputs an error and does not compile the…
yoyo_fun
  • 2,267
  • 3
  • 17
  • 22
10
votes
1 answer

Why does GCC use AT&T syntax by default?

I think title says it all :) Is there any particular practical reason (I guess it's mostly historic, but I'm unable to find it on my own) why GCC uses AT&T/GAS syntax? Note: I know this is just default and you can switch it Note 2: I personally find…
Vyktor
  • 211
  • 2
  • 6
9
votes
2 answers

Questions about linking libraries in C

I am learning C (still very much a beginner) on Linux using the GCC compiler. I have noticed that some libraries, such as the library used with the math.h header, need to be linked in manually when included. I have been linking in the libraries…
james
  • 93
  • 1
  • 5
8
votes
2 answers

Is it wise to use Clang for personal code analysis in a project that builds with gcc?

I started to work on several C projects that are building using gcc. I believe this choice was made for several reasons: Had to cross-compile for arm very early on (I think). Performance is the first and foremost spec. gcc was and is still the easy…
nathdwek
  • 271
  • 1
  • 4
7
votes
1 answer

Difference between direct and indirect function() calls

I am curious about the Difference between direct and indirect function() calls Could anyone help in the diff analysis ? The c source code could be found at subroutine_direct.c and subroutine_indirect.c Note: the diff could be regenerated using…
kevin
  • 187
  • 1
  • 1
  • 2
7
votes
2 answers

Need help eliminating dead code paths and variables from C source code

I have a legacy C code on my hands, and I am given the task to filter dead/unused symbols and paths from it. Over the time there were many insertions and deletions, causing lots of unused symbols. I have identified many dead variables which were…
Anjum Kaiser
  • 171
  • 1
  • 2
7
votes
3 answers

Does using GCC specific builtins qualify as incorporation within a project?

I understand that linking to a program licensed under the GPL requires that you release the source of your program under the GPL as well, while the LGPL does not require this. The terminology of the (L)GPL is very clear about this. #include…
DavidJFelix
  • 335
  • 2
  • 9
1
2 3