gcc

How to call a function just before returning in C ?

Hi, I'm trying to execute something at the end of a function just before it returns to the caller. To Do so, I would like to override return in a certain context. The behavior should be the same as __cyg_profile_func_exit, but I would like to activate it only for some functions. I don't know if it's possible using gcc builtins or this ...

Is Objective-C on Linux garbage collected?

Objective-C v2.0 (which is what the mac uses) got a new feature, Garbage Collection. I'm a kid on a Linux PC (Ubuntu in case your wondering). So my question is, using the gcc/g++ compiler is Objective-C Garbage Collected? ...

What is the difference between gcc -ggdb and gcc -g

Hi When I use gcc under Linux to compile some c programs, I usually use -g to get some debug information into the elf file so that gdb can help me when that is needed. However I noticed that some use -ggdb, since it is supposed to make the debug info more gdb friendly. (And I guess that it is correct to use -ggdb since I debug wi...

What is a "Symbolication warning"?

I've got a user reporting crashes in my Mac OS X application, and their console logs report the following: Symbolication warning: error parsing FDE at 0x100052649 in:\n Does anyone have any insight into what this might be? I assume that somehow the symbols have been stripped from my app in a way that gets in the way of Mac OS X's cras...

Fastcall GCC example

Could some one provide an example use of fastcall for use with gcc? If possible could you provide the equivalent call without using fastcall and explain how they would be different? ...

import all variables of parent class

You may have notice that later versions of gcc is more strict with standards (see this question) All inherited members of a template class should be called using the full name, ie. ParentClass<T>::member instead of just member But still I have a lot of old code that does not respect this. Adding using ParentClass<T>::member for ea...

Error in C Program

Hi, while(((long)(1000*ratio*((long)clock()-(long)t0))%100)/1000)<Data_Read_Rate); The above line is generating the following error: "Syntax Error before < token". Why is this error coming up? I use MINGW32 for development(GCC compiler). Thanks... ...

Is there a GCC preprocessor directive to check if the code is being compiled on a 64 bit machine ?

I am trying to do something like the following; #ifdef 64-bit #define DECIMAL_FORMAT %ld #else #define DECIMAL_FORMAT %d #endif . intptr_t d; . printf(“Some message with DECIMAL_FORMAT in the middle of it\n”, d); The variable 'd' being of the type 'intptr_t' needs '%d' format specifier on 32 bit machines and format specifier...

c++ conditional macro evaluation

I have a symbol defined globally that needs to be conditionally undefined for a given subset of my source files. All of the files that require special treatment are already wrapped in pre- and post-inclusions: pre.h: #undefine mysymbol // [1] post.h: #define mysymbol MY_SYMBOL_DEFINITION // [2] My problem is that the pre.h and pos...

Is it possible to compile Linux kernel with something other than gcc

I wonder if someone managed to compile the Linux kernel with some other compiler than gcc. Or if someone have ever tried? Question may seem to be silly or academic, but it arose when I thought about answers to: Are C++ int operations atomic on the mips architecture It seems that the atomicity of some operations depends not only on the ...

Why do I have to define LD_LIBRARY_PATH with an export every time I run my application?

I have some code that uses some shared libraries (c code on gcc). When compiling I have to explicitly define the include and library directories using -I and -L, since they aren't in the standard places. When I try to run the code, I get the following error: ./sync_test ./sync_test: error while loading shared libraries: libsync.so: can...

how to make gcc spit out a mapping from flow graphs to source code line numbers

Can gcc spit out, given a C file, a list of the all function calls that occur, with filename and line number both for the call itself and for the function's declaration? I know gcc somehow retains this information with -g (debuggers rely on it) and that it can dump control flow graphs with -dr (but without filenames or line numbers); bu...

Is int x = 'fooo' a compiler extension?

I have seen and used C++ code like the following: int myFourcc = 'ABCD'; It works in recent versions of GCC, not sure how recent. Is this feature in the standard? What is it called? I have had trouble searching the web for it... EDIT: I found this info as well, for future observers: from gcc documentation The compiler values a...

compile error: cpumask.h: "and" may not appear in macro parameter list

I'm trying to move a project from an old linux platform to a kubunutu 9.04. Now I get this error when compiling with gcc 4.3.3: /usr/src/linux-headers-2.6.28-11-generic/include/linux/cpumask.h:600:37: error: "and" may not appear in macro parameter list If I understand the message right, it is not allowed to use "and" as a macro parame...

GCC compiler error: "redefinition...previously defined"

I'm getting a lot of " redefinition of x....x previously defined here". Please what does this error means? ...

How do I add an icon to a mingw-gcc compiled executable?

In Windows, using mingw's gcc, is there anyway to specify that the output exe file is to take an icon file, so that the exe file shows with that icon in explorer? ...

Bug fixed with four nops in an if(0), world no longer makes sense.

I was writing a function to figure out if a given system of linear inequalities has a solution, when all of a sudden it started giving the wrong answers after a seemingly innocuous change. I undid some changes, re-did them, and then proceeded to fiddle for the next two hours, until I had reduced it to absurdity. The following, inserted...

GCC/Make Build Time Optimizations

We have project which uses gcc and make files. Project also contains of one big subproject (SDK) and a lot of relatively small subprojects which use that SDK and some shared framework. We use precompiled headers, but that helps only for re-compilation to be faster. Is there any known techniques and tools to help with build-time optim...

Template Meta-programming with Char Arrays as Parameters.

I'm playing around with TMP in GCC 4.3.2's half-implementation of C++0x, and I was wondering if there was a way to somehow do the following: template <char x, char... c> struct mystruct { ... }; int main () { mystruct<"asdf">::go(); } It obviously won't let me do it just like that, and I thought I'd get lucky by using user-defin...

Execution without OS

How do you compile a C program in to a valid ELF format(or RAW format) so that it can be executed directly from RAM without any OS? Assume that a bootloader exists which is capable of loading the code to any location in RAM and start execution at that address? To be precise , what should be the compiler(GCC) flags? Is there a need for a...