gcc

How to deal with sstream vs. strstream inconsistency from old compilers

I'm temporarily using gcc 2.95.2, and instead of having a sstream header, it defines a (slightly different, and deprecated) strstream. I'm currently getting around this with #if __GNUC__ < 3 // or whatever version number it changes #include <strstream> #else #include <sstream> #endif and then things like: #if __GNUC__ < 3 s...

Learning x64 on a linux system

I am looking for some good resources on x64 assembly on a linux system, in order to write code myself. I am also looking for some introductory notions like memory spaces (stack, heap, etc.). I found a good free book online, Programming From the Ground UP, the trouble is, it is targeted at x32 linux systems. I also played a lot with gcc -...

How can you get a 4.2 release of g++/gcc for windows?

How can you get a recent release, i.e. 4.2+, of g++/gcc for windows? Mingw's standard g++ is 3.4.5 which is 3 years old, released Nov 2005. Mingw have a 4.2 version but this is only in the Alpha stage. I cannot find a stable recent release of g++ for windows, surely I must be missing something. ...

C typedef: parameter has incomplete type

GCC 3.4.5 (MinGW version) produces a warning: parameter has incomplete type for line 2 of the following C code: struct s; typedef void (* func_t)(struct s _this); struct s { func_t method; int dummy_member; }; Is there a way to fix this (or at least hide the warning) without changing the method argument's signature to (struct s *)? N...

Code injection - Solaris & Linux

I have an executable module created by third party. I would like to "inject" my code (kind of watchdog running in separate thread) into this process. So far there are two possible ways - one is to run my code as executable and dynamically load a proess on top of it (seems to be very hard and tricky) or to make my code a shared object, ...

hide defined but not used warning with gcc?

hi i have a bunch of compile time asserts and do something like CASSERT(isTrue) or CASSERT2(isTrue, prefix_) in GCC i get many "warning 'prefix_LineNumber' defined but not used" is there a way i can hide warnings for compile time asserts? i had no luck searching the gcc documentation then thought i may hack something by having the var a...

GCC Template issue

Visual Studio compiles this code fine, but gcc only lets it compile without the Template operator. With the Template operator it gives the following errors: Line 29: error: expected `;' before "itrValue" class Test { public: Test& operator<<(const char* s) {return *this;} // not implemented yet Test& operator<<(size_t s) {r...

Restricting symbols in a Linux static library

I'm looking for ways to restrict the number of C symbols exported to a Linux static library (archive). I'd like to limit these to only those symbols that are part of the official API for the library. I already use 'static' to declare most functions as static, but this restricts them to file scope. I'm looking for a way to restrict to ...

Switching off optimization for a specific function in gcc 4.2.2

Is it possible to switch off optimization of a specific function? A friend of mine has the problem that the gcc optimization makes some (unknown to me) µ-controller-code not work. We know which functions it is, but we have no clue of the code itself so the easiest and safest way would probably be to just switch it off for the whole funct...

profile linking times with gcc/g++ and ld

I'm using g++ to compile and link a project consisting of about 15 c++ source files and 4 shared object files. Recently the linking time more than doubled, but I don't have the history of the makefile available to me. Is there any way to profile g++ to see what part of the linking is taking a long time? Edit: After I noticed that the ...

Casting related invalid lvalue in unary &

I'm getting the invalid lvalue error using gcc 3.4.6. The line that invokes the error has a function that receives a pointer to SetElement (which is typedef void*). I'm trying to achieve this using casting from another type (also typedef void*) the following way: &((SetElement)my_var). gcc complains about this. Any idea what can be done?...

gcc -Wall and -Wunknown-pragmas

-Wall enables a warning I do not want. Specifically -Wunknown-pragmas, how do I have GCC suppress the message after it is enabled by Wall ? ...

How to vectorize with gcc?

The v4 series of the gcc compiler can automatically vectorize loops using the SIMD processor some modern CPUs, such as the AMD Athlon or Intel Pentium/Core chips. How is this done? ...

What compilers besides gcc can vectorize code?

GCC can vectorize loops automatically when certain options are specified and given the right conditions. Are there other compilers widely available that can do the same? ...

Practical use of automatic vectorization?

Has anyone taken advantage of the automatic vectorization that gcc can do? In the real world (as opposed to example code)? Does it take restructuring of existing code to take advantage? Are there a significant number of cases in any production code that can be vectorized this way? ...

Auto-vectorizing vs. vectorized code by hand

Is it better in some sense to vectorize code by hand, using explicit pragmas or to rely on or use auto-vectorization? For optimum performance using auto-vectorization, one would have to monitor the compiler output to ensure that loops are being vectorized or modify them until they are vectorizable. With hand coding, one is certain th...

disable gcov in gcc build

Anyone know how, when making GCC, to tell it not to build gcov? It's giving me lots of errors for my target (powerpc-wrs-vxworks). ...

Code Sourcery GCC vs Vanilla GCC Compiler, what is the difference?

I've found a company that provides GCC based toolchains for ARM, MIPS but I don't know in what are they different from the vanilla GCC, of course, they bring other software pieces such as Eclipse, but when looking only at GCC and Binutils, are they different or just the same? ...

The latest version of gcc to use libstdc++.so.5

What is the latest version of gcc that still uses libstdc++.so.5 (as opposed to libstdc++.so.6)? ...

What is gcc serial?

Hello, I am compiling some benchmarks, and it says that I can try the option gcc-serial instead of only gcc, can anyone please explain the difference between gcc and gcc serial?. The place where that appears is here and it is mentioned for example in the slide 71. It is mentioned in more places but in none of them say what is gcc-serial...