Category "c++"

Calling C++ member functions via a function pointer

How do I obtain a function pointer for a class member function, and later call that member function with a specific object? I’d like to write: class Dog

Is there a way to decrease space utilization and potentially improve time performance for string manipulation in my C++ code?

I'm working on a string manipulation code in C++ for my assignment, where I have to find a substring within a string and essentially replace it with a newly com

Can the global offset table manually be defined?

I'm attempting to build a flat 32-bit PIC binary with the following C++ code: extern "C" { void print(const char *){} void entry_func() { print("abcd\n"); }

Ternary operator applied to class with conversion operator and delete constructor causes ambiguity

struct A { A(); A(int) = delete; operator int(); }; int main() { true ? A{} : 0; } Compile with C++20, Clang accepts it, but GCC and MSVC reject it w

Android Hal is not registered at runtime in Android R(11)

I added my hal interface in manifest.xml, vendor_compatibilityMatrix.xml, and also in device.mk. And also I have created hal.rc file as well for my hal. but at

How to use visual studio for GitHub actions?

We have a jenkins server setup in AWS on an ubuntu machine. Created two machines on windows server 2012 and each having visual studio enterprise edition install

How can I repair this error that occurs occasionally when my code is running?

Sometimes the code runs till the end without any errors while other times it stops in the middle and gives me this error Thread 1: EXC_BAD_ACCESS (code=EXC_I386

C++ Lua access violation when table size is above treshold

Recently I became Lua expert in my team due to an issue occurring when we want to send a large table to the following function: int native_sl_shootlaserpulse(

How can I add compiler warnings in CMake that exclude Protobuf files?

I'm adding warnings (and treating them as errors) to my C++ project which uses CMake for builds. Initially I used target_compile_options. But as I've added more

HOW to link or well include winrt to compile your project

fatal error: experimental/coroutine: No such file or directory this is the error the compiler gives me here's main.cpp #include <fstream> #include <io

Safe ways to retain an encryption key in a local service memory after a reboot?

I'm writing a Windows service that receives an encryption key from our web server. Such key never leaves memory and is used to encrypt and decrypt sensitive dat

C++: how to transfer files to netcat listener?

I'm working on an IRC server using c++, and I want to add files transfer to my server, but I don't know how to create the file in the user's host. I can read th

How to test whether stringstream operator>> has parsed a bad type and skip it

I am interested in discussing methods for using stringstream to parse a line with multiple types. I would begin by looking at the following line: "2.832 1.3067

Getting invalid pointer error for openmp parallel code

I am trying to compute the number of triangles for each edge in an OpenMP parallel code. Following is the code snippet where I am doing it. While running with m

Regex in c++ for maching some patters

I want regex of this. add x2, x1, x0 is a valid instruction; I want to implement this. But bit confused, how to, as I am newbie in using Regex. Can anyone share

Different C++ fork() behavior between CentOS 7.5 & RockyLinux 8.4, Ubunu 20.04

I'm working with some legacy code. It works fine on a CentOS 7 system. The args array gets hosed on both a Rocky 8.4 and Ubuntu 20.04 system. I've simplified th

D3D : hardware mip linear blending is different from shader linear blending

I have a d3d application that renders a mip mapped cubemap in a fullscreen quad pixel shader. I stumbled on a weird behavior, and wrote the following test to il

BLE using ESP 32

I am trying to program a BLE client using an ESP32. I have used the attached code (which is the example code from the example section). My problem right now is,

Leetcode Q9 Palindrome Number same code works in Java but not in C++

I tried solving this problem: https://leetcode.com/problems/palindrome-number/ using code: class Solution { public: bool isPalindrome(int x) { int r

Custom substitutions for compression in the Itanium ABI

The Itanium ABI has some rules for compressing identifier for name mangling: for instance, given namespace foo { struct string { void f(); }; }; the f