Variable named i386 generated by Matlab Coder
I'm generating code for a function with several variable-sized arrays. The code needs to be compiled in both linux (with gcc) and windows machines (with MinGW).To "ensure capacity" in those variables,...
View Articlehow to use the gcc preprocessor macro __FAST_MATH__?
man gcc(1) says: the option -ffast-math causes the preprocessor macro __FAST_MATH__ to be defined. Is there any further documentation of that macro?I would expect that code...
View ArticleIs there a C snippet that computes overflow-safe addition efficiently without...
Here is a C function that adds an int to another, failing if overflow would happen:int safe_add(int *value, int delta) { if (*value >= 0) { if (delta > INT_MAX - *value) { return -1; } } else {...
View ArticleHomebrew cannot find gcc
I'm having trouble getting homebrew to work on Lion. For some reason, it is picking up clang rather than gcc.==> Upgrading gnutls ... checking for gcc... /usr/bin/clang checking whether the C...
View ArticleQt: QtConcurrent - Why does the pointer not change?
I'm doing my first steps in QtConcurrent. I try to implement an iterating calculation and in order to avoid copying large amount of data (in this example it's reduced for demonstration purpose) I...
View Articleconfigure CXXFLAGS refuses to accept more than one include path
I am trying to build a project that requires two include paths. My command is: ./autogen.sh --prefix /usr/ --libdir /usr/lib/x86_64-linux-gnu/ CXXFLAGS="-I${TensorflowPath}...
View ArticleUsing builtin overflow functions with uint64_t types
I am currently writing a program which makes heavy use of the uint64_t type, to enhance compatibility across platforms. As it happens, there are a lot of possibilities for overflows in my program, so I...
View ArticleHow to specifically use assembly inline in C? [duplicate]
Let's say I have the following function in C:void sum(){ float a,b,ans; a = 1.0; b = 2.0; //I do use scanf for a and b for for simplicity i'll just use random numbers ans = a+b; printf("Answer is...
View ArticleIs there a way to avoid preprocessor macros when taking an argument from the...
I am writing a library that needs to do some compile time calculations, and builds an array of compile time constants. The issue is I need a way to specify the max size of this array... The only way I...
View ArticleHow to return two 256 bit YMM values in register YMM0/1 in a function (no...
My goal is to return a 4x4 floating point matrix as a return value of a function without using memory. As pointed out by the Wiki article of the "x86 calling...
View ArticleHow can I compose translation units in C? [duplicate]
Essentially what I want to do is the C equivalent of:translation_unit_list.cppstd::vector<std::string> list; bool addListItem(std::string str){ list.push_back(str); return true; } int main(int...
View Articlex86_64 assembly instructions changed in link stage of GCC
I'm compiling a program using the sqlite3 libary in Linux(centos7_64). As the user has an old CPU, I set the -march=nehalem flag in GCC (-march=nehalem -mtune=nehalem -m64 -O3). I find I can't limit...
View ArticleCan global variables be defined multiple times? [duplicate]
#include <stdio.h> int data; int data; int data; int main(void) { printf("%d\n", data); return 0; } The code can be compiled and run sucessfully. Is it wierd?environment: gcc-9 (Homebrew GCC...
View ArticleWhen compile llvm 3.1, why get error: expected primary-expression before ‘>’...
For some reason, I need to install llvm 3.1 or llvm 3.0, but I'm getting this error when during make. [ 5%] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/AsmMatcherEmitter.cpp.o In file...
View ArticleCMake with CUDA add breaking linking line
I have a project that requires some dependencies compiled with GCC 9.2.0. The project also depends on CUDA, as I have some kernels. I am using CMake in Linux. For the project itself, I am also...
View ArticleWhat are the GCC default include directories?
When I compile a very simple source file with gcc I don't have to specify the path to standard include files such as stdio or stdlib.How does GCC know how to find these files?Does it have the...
View ArticleUsing base pointer register in C++ inline asm
I want to be able to use the base pointer register (%rbp) within inline asm. A toy example of this is like so:void Foo(int &x) { asm volatile ("pushq %%rbp;" // 'prologue'"movq %%rsp, %%rbp;" //...
View ArticleCompilation of x264 project
I had downloaded the source of x264 library.The version of x264 is 148.For compilation of shared dlls I am using the following command under MSYS Environment:./configure --disable-cli --enable-shared...
View ArticleSurprising expansion of variadic GNU C preprocessor macros in the presence of...
If we define a macro#define M(x, ...) { x, __VA_ARGS__ } and then use it passing itself as an argumentM(M(1, 2), M(3, 4), M(5, 6)) then it expands to the expected form:{ { 1, 2 }, { 3, 4 }, { 5, 6 } }...
View ArticleCan't compile C program on a Mac after upgrade to Mojave
I have used the gcc command on the terminal to compile C programs but all of a sudden, after an update to my Mac's OS (to macOS 10.14 Mojave, and XCode 10.0), I started receiving the...
View Article