Category "c++"

What is the fastest way to check if any files in a directory tree have changed?

Currently I'm checking against an XOR Checksum of the modified file time (st_mtime from fstat) for every file in the tree. I'm coupling this with the number of

Use of a functor on for_each

Why does the for_each call on functor doesn't update sum::total at the end? struct sum { sum():total(0){}; int total; void operator()(int element)

Sum of two chars in C/C++

In C/C++ when I want to find sum of two chars - I get result in int. For example: #include <stdio.h> int main(){ char a = 'a', b = 'b'; printf("%d

Inheritance of copy constructors in C++17

Consider the following example: struct Parent { Parent (); Parent (const Parent &); }; struct Child : public Parent { using Parent::Parent; }

Is there any method to abort cin or scanf

I have a multithreaded program in which on thread waits for input through a terminal and the other will get data from the socket. Is there any way to abort firs

Would float point format be affected by big-endian and little endian?

I know the integer format would be different between big-endian machine and little-endian machine, is it the same for float point format (IEEE 754)?

Error message "error: stray '\302' in program"

I'm using Code::Blocks on Ubuntu 10.10 (Maverick Meerkat). I have connected a Mac keyboard and set the keyboard settings to "Swiss German Mac". Now wheneve

How to disassemble a binary executable in Linux to get the assembly code?

I was told to use a disassembler. Does gcc have anything built in? What is the easiest way to do this?

Putting C++ string in HTML code to show value on webserver

I've set up a webserver running on ESP8266 thats currently hosting 7 sites. The sites is written in plain HTML in each diffrent tab in the arduino ide. I have i

Kcachegrind cycle estimation

After going to their github page and seeing some pdf manual form their kde docs site, I am still confused. Suppose there are these two lines in a test code: do

Why should I always enable compiler warnings?

I often hear that when compiling C and C++ programs I should "always enable compiler warnings". Why is this necessary? How do I do that? Sometimes I also hear

Performance of built-in types : char vs short vs int vs. float vs. double

Seeing Alexandre C's reply in the other topic, I'm curious to know that if there is any performance difference with the built-in types: char vs short vs int vs

Where do calendar messages in PST files store appointment times and dates?

I am using the PST File Format SDK to try and extract some appointment item data from an Outlook PST export: int main() { pst myfile(L"export.pst"); fo

How to implement C++ (in)equality operators for aggregate structs?

Sometimes I have structs such as this -- struct aggregate1 { std::string name; std::vector<ValueT> options; size_t foobar; // ... }; -- where (

How to create QT Window and use pure OpenGL core profile inside?

I don't want to use QOpenGLWidget, because of the old version of OpenGL inside. I don't understand what is the difference between getting QOpengGLFunctions from

Qt 5.1.1 compiler setup on Ubuntu

First of all, I should point out that I've never used linux before. I have a clean install of 64bit ubuntu, I downloaded Qt 5.1.1 for linux 64 bit from http://

How do I use a custom deleter with a std::unique_ptr member?

I have a class with a unique_ptr member. class Foo { private: std::unique_ptr<Bar> bar; ... }; The Bar is a third party class that has a create

C++ namespace "std" has no member "format" despite #include <format>

I am new to C++. I am trying to store the current date and time as a string variable. At this question, I found an answer, and installed the date.h library. How

How does `gdb` compute the bounds of a stack frame?

I am debugging a new thread library, in which I set the stack register rsp manually (to switch to a user-managed stack), and then invoke a function which never

C++ Double Address Operator? (&&)

I'm reading STL source code and I have no idea what && address operator is supposed to do. Here is a code example from stl_vector.h: vector& operat