Address sanitizing Boost.Python modules

My project includes a large C++ library and Python bindings (via Boost.Python). The test suite is mostly written on top of the Python bindings, and I would like to run it with sanitizers, starting with ASAN. I'm running macOS (10.13.1 FWIW, but I h...
more »

2017-12-03 14:12 (1) Answers

Bitfield endianness in gcc

The endianness of bitfields is implementation defined. Is there a way to check, at compile time, whether via some macro or other compiler flag, what gcc's bitfield endianness actually is? In other words, given something like: struct X { uint32...
more »

2017-12-01 20:12 (1) Answers

Calling C++ Code with a struct from C#

I was given a third party library that wraps unmanaged C++ code into a C# api, one of the functions has a parameter that appears to be a struct from the native global namespace how do we create an instance of that struct in C#? This is the c++ Struc...
more »

2017-11-30 23:11 (1) Answers

Is CAS a loop like spin?

I came across a problem when I read the code of sun.misc.Unsafe.Java. Is CAS a loop like spin? At first, I think CAS is just an atomic operation in a low-live way. However, when I try to find the source code of the function compareAndSwapInt, I fin...
more »

2017-11-30 10:11 (3) Answers

Extract int value and string from string

I would like to use string class, to extract some information from the string. Given the string: <12,Apple>,<20,Orange>,<49,iPhone> I would like to let 12, 20, 49 to a int array. that means a[0] = 12, a[1] = 20, a[2] = 49. And let Apple, O...
more »

2017-11-30 04:11 (1) Answers

Array size in C++

I made a code in which I had to take the size of an array as the user’s input and its elements too and print them. #include <iostream> using namespace std; //Compiler version g++ 6.3.0 int main() { int i; cout<<"\nenter t...
more »

2017-11-29 11:11 (2) Answers

C++ Levelization and Dependency Analysis for Xcode

I have a C++ project with around 1700 source code files and headers where I'm trying to extract platform-independent classes for a cross-platform C++ dynamic library. But there are terrible dependencies on platform-specific code all over the place, ...
more »

2017-11-29 05:11 (0) Answers

Printing using libusb

Hello I am working on project that need to print directly to USB printer (POS printer). The application is running on Linux, right now i am using the usblp to print by write ESCP command directly to /dev/usb/lp0. Everything goes well, but the problem...
more »

2017-11-28 04:11 (0) Answers

C# DllImport crashes unexpectedly

I have a C# Application with a C++ component. I am communicate with DllImport between the modules. The Application works for many days without a problem and crash sometime unexpectedly. [DllImport("recorder", CallingConvention = CallingConvention.Cd...
more »

2017-11-27 09:11 (1) Answers

Eclipse C++ Header and Files Issues

Is there a way to create a class with a cpp file in Eclipse for C++ without the header? Also, is there a way to run a single file, without putting it in its own project or something? I searched online, but I was unable to find answers that answered b...
more »

2017-11-25 22:11 (1) Answers

C++ Array (disregarding a repeat number)

I am a beginner programmer and I need some assistance. I need to write a program that reads an array of 10 numbers from a user, then scans it and figures out the most common number/s in the array itself and prints them. If there is only one number th...
more »

2017-11-24 21:11 (7) Answers

GCC - Macro containing compilation flags

Is there any macro in GCC that contain compilation flags used to compile the program? I want something like this: printf("Compilation flags: %s", __FLAGS__); To output for example: Compilation flags: -02 -g ...
more »

2017-11-20 16:11 (2) Answers

How to set bits in byte without loop

I am really confused, but cannot to do simple task as it seems: I simply need to set number of bits in byte. For example: I need 5 bits set. So I need 0xb00011111. Is it possible to do this without loop? Also I'd not like to write lot of #defi...
more »

2017-11-20 13:11 (3) Answers