I need to convert C# app which uses extensively bytes manipulation. An example: Basically BitConverter and Buffer.BlockCopy called 100s times per sec. There are several classes that inherit from the base class above doing more specific tasks. For example: What approach in C++ should I look into? Answer Best option, in my opinion, is to actually go to C –
Tag: c++11
pointer get wrong value in different thread
I am writing a piece of code to demonstrate the multi-threading share memory writing. However, my code gets a strange 0xffffffff pointer I can’t make out why. I haven’t been writing cpp code for a while. please let me know if I get something wrong. I compile with the command: g++ –std=c++11 shared_mem_multi_write.cpp -lpthread -g I get error echoes like:
Fedora 28 / GLIBC 2.27 libm.so.6 logf() and powf() c++
As I am sure other Fedora 28 users will know, the OS’s glibc was recently updated to glibc 2.27. Amongst many other things, 2.27 has added new implementations of logf() and powf(). This has caused my application to fail to run on distributions with an older glibc (Debian, for example). When the application is invoked on Debian, the following error
Where to find the source code of timespec_get?
The C11 standard provides the function timespec_get. If I run the example code on cppreference, or on my computer, it works: However, if I look at the sources of glibc here, the code is the following: Which… should not work… Which leads to the question: where is the source code of timespec_get that is actually called? Answer The timespec_get function’s
Linking shared objects at runtime depending on user configuration
TL;DR I have a library I want to use in my program which comes in two different versions. Both versions provide the same interface but differ in options used to compile them. I now want to use a specific version of the library, however, since both versions are suitable for different tasks and the user should define the task to
calling std::system with parameter containing space in double quotes
I need to call a linux std::system call with parameter than contain string with spaces. In order to process it correctly using argc / argv I want to pass it with double quotes. std::string cmdline = “myprogram -d “I am a sting”” ; if I cout this string I get good results. When I send it to std::system(cmdline) and look
Poco C++ Libraries: “Not found: mysql”
I am using poco-1.7.7 with MySQL. I am building with g++ on Ubuntu. Building, linking and running works fine. However, when a Data Session is created, an exception “Not found: mysql” is thrown: The mysql client is installed and is part of $PATH. Additional information: I am running Ubuntu using Docker. See below for Makefile. The same code can connect
Issues with compiling caffe with python, undefined reference to `std::__cxx11::….’
I used to compile successfully caffe with WITH_PYTHON_LAYER:=1 on Ubuntu 14.04. Then I switched to Ubuntu 16.04, using the same settings but different built-in software such as g++ 5.4 for 16.04 instead of g++ 4.8 for 14.04, I failed to compile caffe with python. Would you please give me some advice on this issue? The following is part of the
add another timer on already running loop
Given the following program – The second timer handle is never run on the loop, since the loop is already running, and “Timer2 called” is never printed. So I tried stopping the loop temporarily after running it and then adding the second timer – But this again didn’t work, probably because the later lines won’t be executed after 1st loop
access order of std::atomic bool variable
I’ve a function that accesses(reads and writes to) a std::atomic<bool> variable. I’m trying to understand the order of execution of instructions so as to decide whether atomic will suffice or will I’ve to use mutexes here. The function is given below – I’ve read this page on cppreference which mentions – Each instantiation and full specialization of the std::atomic template