Precision of floating-point data types in C++
Why don't the precision of floating-point data types grow proportional to its size? E.g.:std::cout << sizeof(float) << "\n"; // this gives 4 on my machine "debian 64 bit" with "gcc 6.3.0"...
View ArticleBuilding a library consisting of C and C++ files
I have a .so library where all code was written in plain ANSI C, so compiling it is straightforward. Now, I need to add C++ code in it. What would be the compilation process now?Do I have to compile...
View ArticleHow do modern compilers use mmx/3dnow/sse instructions?
I've been reading up on the x86 instruction set extensions, and they only seem useful in some quite specific circumstances (eg HADDPD - (Horizontal-Add-Packed-Double) in SSE3). These require a certain...
View ArticleReason for Overflow (G++ vs Clang++) [closed]
When I'm compiling the following piece of C++ code using Clang++ and G++void ScaleFactor(float32_t scale, int32_t &factor) { factor = floor(log2(abs(scale))+1) cout << factor << endl; }...
View ArticleHow to optimize out function parameters from empty functions [closed]
Let's say I have the empty function belowinline void LOG(char *buff) { return; } And we do the following function callLOG("HELLO WORLD"); I'd expect that a good optimization would remove string "HELLO...
View ArticleCannot run linux executable in Docker container
I have created a Docker Image as ssh container (https://docs.docker.com/engine/examples/running_ssh_service/) and I updated its dockerfile to support C compiler stuff. FROM ubuntu:16.04 ## INSTALLING...
View ArticleBuild through Makefile_1 using another Makefile_2
I have that problem. I want to build my project using Makefile_1 that includes Makefile_2. Makefile_1 already can build all files from the generated Makefile_2 but it can't build my own library. Where...
View ArticleUndocumented ABI changes of std::function between GCC-4 and GCC-5/6/7/8/9,...
with _GLIBCXX_USE_CXX11_ABI=0 std::function of GCC-4 is different of GCC-5 and follwing versions.The following code show you the fact:==> lib.cc <==#include <functional>...
View ArticleUnable to link Shared Library with Eclipse on Ubuntu
Disclaimer: I am not a Eclipse coder on Linux and I will refrain calling it names after being unable to create a shell for a simple EXE with linked Shared Library (a DLL in English).Please be patient -...
View ArticleWhy doesn't clang use memory-destination x86 instructions when I compile with...
I wrote this simple assembly code, ran it and looked at the memory location using GDB: .text .global _main _main: pushq %rbp movl $5, -4(%rbp) addl $6, -4(%rbp) popq %rbp ret It's adding 5 to 6...
View ArticleCompiling gcc with debug flags
I am trying to build gcc version 10.00.1 from source with debugging flags to enable some functions such as methods from the STL to be able to print in GDB. Right now GDB will say things such as "cannot...
View ArticleGettin errors wile useing vs code for ansi color n fonts in C in Windows
#include <stdio.h> int main() { printf("\033[33;3m Hello Master"); }
View ArticleGCC BareMetal Linker Issue - Cortex M3
I have an issue during the linkage of my project. I use the GCC linker script from the manufacturer.In there, i define the code section as follows:MEMORY { // .. deleted other sections CODE (rx ) :...
View Articlegcc cross compilation on windows
I am using windows7,I want to cross compile gcc for powerpc7448,After that I want to run one simple c++ program to get elf file..So to do this, what are all the steps need to be follow or please share...
View ArticleHow to compile and dump assembly for a c library (string.h)?
For a school project I have to do a large amount of string manipulation in assembly. Since this is a pain to do I was trying to come up with innovative ways to use already programmed string operations....
View ArticleHow to compile and run test C program with embedded python in Linux terminal?
people!I am currently working on embedding python function in C application. Now I want to compile a test “HelloWorld” program under Unix-like system using a simple gcc compiler. The program...
View ArticleClang doesn't compile code but gcc and msvc compiled it
I don't understand what's the problem: either in my code or in the compiler (less possible). There is a piece of code like this:#include <iostream> #include <type_traits> #include...
View ArticleBuilding GCC: Is there a way to only build cpp?
I am attempting to build GCC however what I really want is only c pre-processor.Is there a way to build c pre processor on its own?
View ArticleEndianess macros not correctly defined [closed]
I'm trying to compile grpc, and one of the targets uses /usr/include/netinet/tcp.h which contains this :# if __BYTE_ORDER == __LITTLE_ENDIAN uint8_t th_x2:4; /* (unused) */ uint8_t th_off:4; /* data...
View Articletinydtls configuration in Contiki
I am currently trying to configure tinydtls as described in the README in order to later include it into an application, or at least, make the examples run.The first steps home/contiki/apps/tinydtls$...
View Article