C++ utf-8 literals in GCC and MSVC
Here i have some simple code:#include <iostream>#include <cstdint> int main() { const unsigned char utf8_string[] = u8"\xA0"; std::cout << std::hex << "Size: "<<...
View ArticleHow to install older version of GCC on Windows 10
I need to install MinGW GCC 7.3 on my computer for a project. Downloaded and installed: C:\MinGW\bin\MingGW-get.exe. But when I run it, it only gives me the option to install the latest GCC v9.2.0. How...
View ArticleSeparate debug symbol file(s) for Linux kernel
I know that when compiling a program with debug symbols (e.g. using gcc -g), I can separate the debug symbols into their own file using objcopy. Later, the file of debug symbols can be used to debug...
View Articledoes gcc link order affect speed of the program execution
I know the linkage order in gcc is important for symbols to be correctly determined; but now I am seeing a weird speed issue on the resulting executable. I am linking objects and archieves asg++ -m32...
View ArticleExplicit specialization in define causes error: explicit specialization in...
I'm getting explicit specialization in non-namespace scopeerror from this define:#define DECLARE_INTERNAL_LINK_SPECIALIZATION(T, Counter) template<> struct T<Counter>This is how the define...
View ArticleHow to compile a gcc compiler for arm on a X86 PC
i am using zedboard, I know that if I want to compile a program for an ARM device I need a special version of gcc that runs under x86 and compiles for ARM (cross compiling) ,i want to know is it...
View ArticleHow and where does clang use llvm?
When using command like this:clang -### -O3 -a.cAnd then, it will output the followings:clang version 1.1 (branches/release_27)Target: x86_64-unknown-linux-gnuThread model:...
View ArticleIs there a compiler warning for casting double pointer to single pointer?
Consider the following code which is a simplified version of something I did IRL (and have done a couple of times) where there is an "extra" address-of operator which should not be there.#define HEAD \...
View ArticleDestructor of a future in async C++11
Should not a compiler call the destructor of the future future right after the main finishes, that is, should not be the function f() called anyway? (gcc 4.7.2 doesn't do that).#include...
View ArticleWhy does this code yield an error with regards to the pow function?
#include <stdio.h>#include <math.h>int exp_for_level(int n) { return (int)(100 * pow(n, 2.3));}int main(){ int x; x = exp_for_level(6); printf("%d", x); return 0;}I receive the following...
View Article-fshort-wchar and std::wstring - segmentation fault
I use Ubuntu 18.04 and gcc 7.5.0. I have a library which is compiled with -fshort-wchar. I have noticed that using std::wstring in the library may leads to the segmentation fault. I have found a...
View ArticleC: why printing a null char with %s prints "(null)"?
Why does printing a null char ('\0', 0) with %s prints the "(null)" string actually?Like this code:char null_byte = '\0';printf("null_byte: %s\n", null_byte);...printing:null_byte: (null)...and it even...
View Article'_Float128' is not supported on this target
I'm compiling Buildroot 2020.01.02 for an ARM architecture.My compiler version is : COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/lto-wrapperCible : x86_64-pc-linux-gnuConfiguré...
View Articlewhile reversing string 'my.name.is' i'm getting output as 'is@.name.my'. I...
Given a String of length S, reverse the whole string without reversing the individual words in it. Words are separated by dots.Input:The first line contains T denoting the number of testcases. T...
View ArticleCmake change compilation flags
I want to run automatic optimization flags benchmark for my cmake project.Project is cross-compiling, basic c/cxx flags are set in toolchain file assignable with -DCMAKE_TOOLCHAIN_FILE=<...>. I...
View ArticleWhich C++ standard library headers invoke a requirement for the -pthread...
If you use C++ threads with the GCC compiler (or perhaps more accurately, with the libstdc++ C++ standard library which ships with GCC) on Linux, you may need to include the -pthread option in your...
View ArticleCUDA incompatible with my gcc version
I have troubles compiling some of the examples shipped with CUDA SDK.I have installed the developers driver (version 270.41.19) and the CUDA toolkit,then finally the SDK (both the 4.0.17...
View ArticleGCC - Multiple precompiled headers and specific paths
BackgroundI have a large Makefile project I'm working on which I'd like to tidy up a bit. It builds several dozen sub-projects, each of which contains roughly 100 .cpp and .h files. I've set it up so...
View Articlefind the line which causes the segmentation fault, which I couldn't find
Currently I am writing a LZ77 algorithm. When I try to run my code, for some reason I get the ZSH segmentation fault. I've searched some topics but I couldn't find where to fix my code for this....
View ArticleHow can we perform an Instruction vulnerability analysis, at bit level? [closed]
In order to improve dependability of a given processor, e.g., ARM processor, vulnerability analysis can be carried out at different levels, for example: architectural vulnerability analysis,...
View Article