Questions tagged [gcc]

GCC is the GNU Compiler Collection. It's the de facto standard compiler for C, C++, Go, Fortran, and Ada 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 an optimizing C compiler that is the most commonly used C compiler on Linux. GCC also includes front ends for C++ (including full support for C++17), Objective-C, Fortran, Ada, and Go, as well as libraries for these languages (libstdc++, libgfortran, ...). It supports many architectures.

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

See also GCC online documentation and the home page, and release dates.

40905 questions
22
votes
11 answers

Are nested functions a bad thing in gcc ?

I know that nested functions are not part of the standard C, but since they're present in gcc (and the fact that gcc is the only compiler i care about), i tend to use them quite often. Is this a bad thing ? If so, could you show me some nasty…
LB40
  • 12,041
  • 17
  • 72
  • 107
22
votes
6 answers

Should I use C++0x Features Now?

With the official release of VS 2010, is it safe for me to start using the partially-implemented C++0x feature set in my new code? The features that are of interest to me right now are both implemented by VC++ 2010 and recent versions of GCC. These…
svu2g
  • 223
  • 1
  • 4
22
votes
3 answers

std::vector : cannot bind 'std::ostream {aka std::basic_ostream}' lvalue to 'std::basic_ostream&&'

I encountered a confusing error message when trying to do something as simple as std::cout << std::vector{1,2,3}; which says cannot bind 'std::ostream {aka std::basic_ostream}' lvalue to 'std::basic_ostream&&' int main() { …
thor
  • 21,418
  • 31
  • 87
  • 173
22
votes
2 answers

Adding two floating-point numbers

I would like to compute the sum, rounded up, of two IEEE 754 binary64 numbers. To that end I wrote the C99 program below: #include #include #pragma STDC FENV_ACCESS ON int main(int c, char *v[]){ fesetround(FE_UPWARD); …
Pascal Cuoq
  • 79,187
  • 7
  • 161
  • 281
22
votes
3 answers

What do the CFI directives mean? (and some more questions)

Ok, this is gonna be a long question. I'm trying to understand how "buffer overflow" works. I am reading Smashing the stack for fun and profit by aleph1 and have just got the disassembly of the following code: void function(int a, int b, int c) { …
Pervy Sage
  • 841
  • 1
  • 10
  • 22
22
votes
1 answer

Why clang selects a gcc installation?

The command "clang -v" prints: $ clang -v clang version 3.4 (tags/RELEASE_34/final) Target: i386-redhat-linux-gnu Thread model: posix Found candidate GCC installation: /usr/bin/../lib/gcc/i686-redhat-linux/4.8.2 Found candidate GCC installation:…
Antonio Rizzo
  • 748
  • 1
  • 8
  • 17
22
votes
3 answers

What is libg2c library?

I have found the code which links against of 'g2c' library. Why do I need it? Just would like to understand why it might be important and what it does in general. Thanks!
musthero
  • 1,267
  • 3
  • 13
  • 18
22
votes
1 answer

Narrowing conversions and initializer lists, which compiler is right?

Considering the following piece of code: #include auto main() -> int { double x(7.0); int i{x}; std::cout << "i = " << x << std::endl; return 0; } When compiled in GCC4.9 it compiles fine with only a warning: warning:…
101010
  • 41,839
  • 11
  • 94
  • 168
22
votes
2 answers

How GCC handles built-in function

I have trouble understanding GCC built-in functions, and feel very confused. What is the difference between a library function and an built-in function? Is there something a built-in function can do but a library function cannot? Can I write a…
PeopleMoutainPeopleSea
  • 1,492
  • 1
  • 15
  • 24
22
votes
1 answer

Minimal example of TAILQ usage out of library

Can some one provide minimal example of TAILQ usage out of linux system library with explanation in c which can be compiled using gcc in Linux?
Khamidulla
  • 2,927
  • 6
  • 35
  • 59
22
votes
1 answer

Unexpected ambiguity of surrogate call functions in C++

On the following code clang and EDG diagnose an ambiguous function call, while gcc and Visual Studio accept the code. struct s { typedef void(*F)(); operator F(); //#1 operator F() const; //#2 }; void test(s& p) { p();…
uwedolinsky
  • 611
  • 3
  • 8
22
votes
1 answer

Finding stack frame size

The stack frame of a caller function can be easily obtained via __builtin_frame_address(1), but what about the stack frame size? Is there a function that will let me know how big is the stack frame of the caller function?
alexandernst
  • 14,352
  • 22
  • 97
  • 197
22
votes
2 answers

Howto add a link to a library in autoconf configure script / makefile

I am an autotools newb and I have difficulties figuring out howto easily link a specific library into one of the configured targets. I have a source package that I want to build the usual way: ./configure && make && make install Unfortunately one of…
AndreasT
  • 9,417
  • 11
  • 46
  • 60
22
votes
4 answers

library isn't found in the GCC version (4.2.1) in Mavericks

I have a problem with GCC. I want to update it to a new version, from the 4.2.1, to program with parallel programming. However, in this version there is no library . How can I download an updated version? The error that the terminal give me…
Mattia Baldari
  • 567
  • 1
  • 5
  • 15
22
votes
2 answers

C++11 backwards compatibility

Is there anything from c++11 that I can use and expect compiled binaries to run on older systems? How can I tell which parts of c++11 are a part of the libstdc++.so and what actually gets compiled into the binary? Maybe I don't fully understand how…
Brian Schlenker
  • 4,966
  • 6
  • 31
  • 44