VSCode including header file in c
I'm trying to work with my header files in c. When i use code blocks, it handles the header include part, but in vs code, i couldn't figure it out yet. this is what i get in vs code. The files are in...
View ArticleFast Division on GCC/ARM
As far as I know most compilers will do fast division by multiplying and then bit shifting to the right. For instance, if you check this SO thread it says that when you ask the Microsoft compiler to do...
View Articlenon-const lvalue reference type _normal_iterator cannot bind a temporary of...
In the last line of the below code I get an error: non-const lvalue reference type _normal_iterator<> cannot bind a temporary of type _normal iterator with gcc, but not with Visual studio. Any...
View Articleas: unrecognized option '--64'
iam not able run this single simple program. i am getting this error . can you anyone please help me to do resolve this. i am using ubuntu 14.4 and gcc 4.8.5..madhu.r@CPU-245U:~$ gcc p1.cas:...
View ArticlePre-increment operator with and without pointer in C [duplicate]
This question already has an answer here:Why are these constructs using pre and post-increment undefined behavior? 14 answersI am running gcc 7.4.0 on ubuntu 18.04. I compiled and ran the following...
View ArticleOn x64 In mutli thread scenario, can each member, of size byte or word, of a...
This question already has an answer here:Can modern x86 hardware not store a single byte to memory? 6 answersC++ memory model and race conditions on char arrays 2 answersstruct test { char hit char...
View ArticleHow to force the compiler to pass a "vector of 4" wrapper class as single XMM...
I'm trying to optimize a small "vector of 4 floats" wrapper class, and of course I want to make it convenient as well. For example:typedef float v4f __attribute__ ((vector_size (16))); struct V4 {...
View ArticleHow to tell GCC to generate 16-bit code for real mode
I am writing real mode function, which should be normal function with stackframes and so, but it should use %sp instead of %esp. Is there some way to do it?
View ArticleIn Makefiles, how to display percentage of compilation followed by compiler's...
This is a bit tricky...I want my Makefile to display progression percentage of my compilation. This is easy as long as I use tput or escaped sequences to move my cursor to modify my percentage.But if a...
View ArticleRun a "light" preprocessor for GCC
Is there a way to run the GCC preprocessor, but only for user-defined macros?I have a few one-liners and some #ifdef, etc. conditionals, and I want to see what my code looks like when just those are...
View Articlewhen I use strlcpy function in c the compilor give me an error
Someone told me to use the strlcpy function instead of strcpy like this#include <stdio.h> #include <string.h> void main() { char var1[6] = "stuff"; char var2[7] = "world!"; strlcpy(var1,...
View ArticleWhy does STL function use node's color to calculate std::map node predecessor
I was looking through libstdc++'s implementation of std::map and noticed that iterator increment and decrement functions are not entirely symmetrical. local_Rb_tree_decrement function (aka predecessor)...
View ArticleCompiler independent class name
I need to print the name of a class such as template<typename... Args> struct S{}; Using typeid(S<int,std::vector<double>>).name() its fairly simple to print something representative....
View Articlegcc: use and practical meaning of preprocessor output flags 3 and 4
While looking at gcc preprocessor output on a file #include-ing a system header, I noticed that linemarkers contained flags 3, or 4, respectively (I found it the definition here: [1]):3 This indicates...
View ArticleC++ incorrect constructor order in gcc compiling static members in generic class
The constructor order problemI have probably faced a bug in gcc compiler when I was solving a problem of making an arbitrary trait of a class like ThorsSerializer does, but more generic. Moreover I am...
View ArticleReverse engineering assembly
Good day. I am struggling to figure out what the following assembly code does. The code is from objdump. To give it some background, a random "string" is generated (for example "68 7"). Before all this...
View ArticleSegmentation Fault when editing code of executable file
Working on a Cyber Security Project: When editing the code of a .exe file in c, it's possible to edit the code of a different exe file but not the exe file itself. It results in a segmentation fault....
View Articleexternal/local_config_mlir/include/mlir/IR/Attributes.h:783:20: internal...
I am trying to build Tensorflow 2.0 on Ubuntu 16.04LTS I get the error with gcc 4.8, gcc 5, gcc 9.2, etc.Here are the version of bazel and gcc:ai) ubuntu@ip-10-0-1-71:~/tensorflow$ bazel --version...
View ArticleHow do I get gcc to print localized error messages? (WSL - Ubuntu 16.04)
I figure I'm just missing one step, but no matter what I try, I can't get localized error messages from gcc. And most searches I've tried turn up people trying to disable the messages and use...
View ArticleWhy I have a wrong result in C after storing a division of integers in a...
This question already has an answer here:C program division error? 7 answersI am working with STM32 and GCC Compiler and I make the following division: uint8_t w, h; w=2; h=5; float test = (w * h) / 8;...
View Article