Initializing a dynamically-sized Variable-Length Array (VLA) to 0 [duplicate]
The following line of code, which creates a variable-length array on the stack:char name[length] = {'\0'};Generates the following compiler diagnostics:error: variable-sized object may not be...
View Articlec enum with 32 bit values
i need some unsigned 32bit enum values for my software, therefore i implemented this (simple) enum:enum{ val1 = 0xFFFFFFFFu, val2 = 0xFFFFFFFEu, val3 = 0xFFFFFFF0};The problem: Everytime i run the...
View ArticleUnable to offload to GPU using openMP in gcc, omp_get_num_devices returns 0
I've made a simple test program to offload a SAXPY workload to the GPU with openMP, but have been unable to detect the presence of the GPU. I'm unsure if the compiler is configured correctly for this...
View ArticleHow to manually throw a compiler error in GCC and Xcode
In xcode, while compiling apps with gcc, I want to throw compilation time errors if things like NSZombieEnabled is on for a distribution release, thus ensuring that compilation will fail and I won't...
View ArticleThe big prefix L has no effect in %Lf, the result in printf() is same as just...
Currently learning about C language, I repeated after guy in tutorial, he used printf("value = %Lf\n", var_some); construction to output the value of long double variable, and it worked.But when I...
View ArticleTrying to no-op an instruction
Is it possible using GNU tools (gcc, binutils, etc) to modify all occurrences of an assembly instruction into a no-op? Specifically, gcc with the -pg option generates the following assembly (ARM): 0x0:...
View ArticleGCC switches to enable analysis for warnings
In GCC, certain warnings require optimization to be enabled. For example:int foo() { int x; return x;}In order to detect the uninitialized variable, -O must be passed.$ gcc -W -Wall -c test.c$ gcc -W...
View Articleld64 -s strip output flag - "ignored" but not really? OS X
I was bored and playing around with various options to gcc to see what size binaries I could produce.I found a -s flag in ld64 that is supposedly supposed to not include symbol table information in an...
View ArticleIs there a way to output the assembly of a single function in isolation?
I am learning how a C file is compiled to machine code. I know I can generate assembly from gcc with the -S flag, however it also produces a lot of code to do with main() and printf() that I am not...
View ArticleC++ #include and #import difference
What is the difference between #include and #import in C++?
View ArticlePrevent optimization of arithmetic computation
I need to implement this paperPage 5, there is a functionvoid Split(double a, double *x, double *y) { double z = a * ((1 << r) + 1); *x = z - (z - a); *y = a - *x;}With -O3 (which I need for the...
View ArticleGCC 4.5/Ubuntu 11.04 is auto-threading code?
I apologize ahead of time that I don't quite have the proper jargon to describe my problem, and that I have likely not given enough information.I've been running my MPI code under gcc 4.4 and...
View ArticleCheck glibc version for a particular gcc compiler
I have two gcc compilers installed on my system, one is gcc 4.1.2 (default) and the other is gcc 4.4.4. How can I check the libc version used by gcc 4.4.4, because /lib/libc.so.6 shows the glibc used...
View ArticleHow can you determine installed versions of the glibc libraries?
I'm working with an embedded Linux deployment and am using a cross compiler tool chain that doesn't compile I2C library function calls.How do I determine the precise versions of the libraries on the...
View ArticleIs there anything wrong with changing the default compiler in Xcode 4.2 to...
I am having some issues in my app since the advent of iOS 5, and I am trying to figure out what in the world is going on. One of the noticeable differences in the development environment is the switch...
View ArticleCompile time comparison between Windows GCC and MSVC compiler
We are working on reducing compile times on Windows and are therefore considering all options. I've tried to look on Google for a comparison between compile time using GCC (MinGW or Cygwin) and MSVC...
View ArticleVisual C++ equivalent of GCC's __attribute__ ((__packed__))
For some compilers, there is a packing specifier for structs, for example ::RealView ARM compiler has "__packed"Gnu C Compiler has "__attribute__ ((__packed__))"Visual C++ has no equivalent, it only...
View ArticleHow do I build a static library for iPhone?
I think that I've looked everywhere for an answer to my problem but without any luck.I'm trying to create a simple static lib to run on the iPhone device but I keep ending up with XCode saying that...
View ArticleSet default GCC to Fink-installed GCC 4.5?
I've got GCC 4.2 that came with my installation of Mac OS X 10.6.4, plus GCC 4.5 installed via Fink. I wanted to use gcc_select to change the default compiler to GCC 4.5, but was told gcc_select does...
View ArticleI am writing my OS. Kernel is in panic state after implementing hardware...
I am trying to enable hardware interrupts and currently implementing PIC, But kernel is going into panic state.I am using nasm and C to write my kernel. Please help.When i call enable_interrupts() in...
View Article