Possible to use a .dll on Linux
Question: Is it possible to compile a program on linux using a .dll file?Where this is going: This .dll will be used to write a php extension to some proprietary software from a third party.Background...
View ArticleThe version of gcc --version is different from the gcc linked [closed]
The command of 'gcc --version' shows that my gcc version is 6.5.0.However, I have linked my gcc to gcc-7.How can I change my gcc to gcc-7?
View ArticleConflicting register allocation in GCC x86_64 asm. Lifetime ignored
I have a function containing a small assembly block. The assembly for this function compiled by GCC is incorrect since it assigns the same register to two different variables. This is the function...
View ArticleHow to use 32-bit w registers in ARM aarch64 GCC inline assembly?
I can use 64-bit registers for example as in:#include <assert.h> #include <inttypes.h> int main(void) { uint64_t io = 1; __asm__ ( "add %[io], %[io], 1;" : [io] "+r" (io) : : ); assert(io...
View Articleisless vs < or isgreater vs > [duplicate]
This question already has an answer here:When to use C float comparison functions? 2 answersCan someone advice what is the difference between isgreater(x,y) and > or isless(x,y) and <. My...
View ArticleWhy the compiler does this division [closed]
I'm trying to optimize nbody algorithm and this operation is expensive real s = jMass / POW(distSqr,3.0/2.0); so I tried to convert in:s = jMass * POW(distSqr, -3.0/2.0); but the compiler gcc with...
View ArticleStrict aliasing and casting union pointers
I have looked around this site to try to figure out if my use of casting to different unions is violating strict aliasing or otherwise UB.I have packets coming in on a serial line and I store/get them...
View ArticleHow fix my codeblocks compile programm use fstream, cannot open files large...
#include <iostream> #include <fstream> #include <string> using namespace std; int main(){ char fileInputPath[256] = "D:\25mb.file"; ifstream fileInput(fileInputPath,...
View Articlescanf integer with %ld %ld is not work correctly
I'm using gcc 4.4.7.When I run below simple logic(C lang).Then inputted '1 2'. int var1 = 0; int var2 = 0; if(!scanf("%ld %ld",&var1, &var2)) { printf("--- ERROR\n"); } else { printf("--- var1...
View ArticleConst correctness in automatic template deduction
In the following example I would expect the line a.foo(j); to pass the const qualifier to the templated method.#include <iostream> #include <type_traits> struct A { template<typename...
View ArticleWhy do calls to _Noreturn generate real calls instead of jumps? [duplicate]
This question already has an answer here:Why noreturn/__builtin_unreachable prevents tail call optimization 1 answerI looked at //#define _Noreturn //<= uncomment to see jmp's change to call's...
View Articlegcc long long int width same as int [duplicate]
This question already has an answer here:How do you format an unsigned long long int using printf? 12 answersI am testing gcc version 8.2gcc seems to be treating long long int as int. Is there any way...
View ArticleWhat does "%:" (percent colon) mean in C? [duplicate]
This question already has an answer here:Why are there digraphs in C and C++? 4 answersIn one of my courses I've been given this cryptic c code.%:define BBRACE ( %:define BRACEE ) %:define CCURLY_BRACE...
View ArticleNew to GCC - running a array insertion gives me different output locally than...
I am going through a TuturialsPoint algorithm and trying to run the C code with GCC. Would anyone know why my local output would be different that what is produced by an online C compiler?#include...
View ArticleUndefined symbol after linking C driver dynamically
I am using the following make file to build an application that links against libbson and libmongoc:CURRENT_DIR=$(shell pwd) INC=-I/usr/local/include/libbson-1.0...
View ArticleTemporarily escape function scope to define global symbols in C? (gcc)
Is there any way, in standard C or failing that with gcc/gas/binutils/etc, to define a global symbol using code (probably a macro) that's written within the syntatical scope of a function definition...
View Articlewhile(i--) optimization by gcc and clang: why don't they use sub / jnc?
Some people write such code when they need a loop without a counter or with a n-1, ..., 0 counter:while (i--) { ... } A specific example:volatile int sink; void countdown_i_used() { unsigned i = 1000;...
View ArticleWhy the command of 'gcc -v' shows the different version from the softlink of...
The command of 'gcc --version' shows that my gcc version is 6.5.0.However, I have linked my gcc to gcc-7 with the command of 'ln - s'.How can I change my gcc to gcc-7?
View ArticleHow did u-boot get the parameters of devicetree? [closed]
i can't find them because the code is encapsulated.Lots of structures 、 pointers and C files make it difficult to find the answers!
View ArticleWhy does program miss 'if' operator? [closed]
The problem is the wrong executing of the program because of it misses condition statements in some function apparently.Here is some example:void f(uint32_t eventsFlags) // eventFlags == 0x1 { //...
View Article