« first day (1808 days earlier)      last day (1045 days later) » 

2:50 AM
I saw this(i.e Array of POD types (std::arrayorstd::vector)) in this article. I googled and found this(i.e What are POD types in C++?). But std::vector is not mentioned in the second article.
Is std::vector a POD?
 
3:31 AM
Hi folks, is there any simpler C++ tricks to calculate j from c if c, M, N, O are given and we know c= MN k + M j + i?
For more detailed question: math.stackexchange.com/q/4180526/271232
 
@John No, std::vector is definitely not a POD. POD stands for "plain old data", so it's a struct/class that only has data members (no ctor, no dtor, no non-static member functions, etc.) Basically, it's POD if (and only if) it would be allowed in a C struct.
 
4:30 AM
Thank you
How to know whether a specific macro in the source code is defined or not for an already built Boost library which was built by myself.

For example, here is a code snippet:
explicit dynamic_vector_buffer(std::vector<Elem, Allocator>& v,
std::size_t maximum_size =
(std::numeric_limits<std::size_t>::max)()) BOOST_ASIO_NOEXCEPT
: vector_(v),
#if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1)
size_((std::numeric_limits<std::size_t>::max)()),
#endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1)
max_size_(maximum_size)
 
4:49 AM
The aforementioned code snippet is quoted from /usr/include/boost/asio/buffer.hpp
 
5:22 AM
@John If you want you can pre-process the code, and look at the result. It's painful though--huge amounts of source code, including a massive number of blank lines as a rule.
 
6:06 AM
@JerryCoffin Any better choice? It seems that it's worse than putting a breakpoint at there.
 
6:54 AM
@John Depending on your compiler, you may be able to get it to print out a list of what macros are defined. For example, gcc -dN will output preprocessed source and a list of what macros are defined.
 
Fortunately, I am using gcc. But you see, Boost is a CMake project. How gcc -dN could be invoked when building the Boost?
 
7:22 AM
Sorry, but I only deal with CMake when/if I have no choice in the matter.
 
7:56 AM
@JerryCoffin: Have you an experience of writing a framework? I want to know how a framework actually works behind the scene. In my imagination, when we use a framework, for example DI framework, to develop our applications then when we run our apps, they will invoke the framework executable. The rest is just orchestration between both our apps and the framework. Is there a trivial example to simulate this thought?
Should a framework have an entry point of its own? Or can it be just a library without an entry point?
 
 
2 hours later…
9:51 AM
What is the linker option of cl.exe? I attempted cl.exe with /L or /LINK but both are considered unknown options. :-)
 
nwp
It is uncommon to call cl.exe manually. You should make your build system / IDE do that automatically.
With enough patience you might be able to find the flags here.
 
@nwp: Thanks. I am using visual studio code.
 
nwp
I'm sure VSC has a plugin or even default setting that already has all that set up for you.
 
{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: cl.exe build active file",
			"command": "cl.exe",
			"args": [
				"/Zi",
				"/EHsc",
				"/nologo",
				"/I",
				"${env:MS_CPP_INCLUDE}",
				"/I_DON'T_KNOW_HOW_TO_ADD_LIB_DIR",
				"${env:MS_CPP_LIB}",
				"/Fe:",
				"${fileDirname}\\${fileBasenameNoExtension}.exe",
				"${file}"
			],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$msCompile"
			],
			"group": {
				"kind": "build",
The default does not work.
 
nwp
Try this.
 
9:59 AM
I am also reading and following the tutorial.
 
nwp
Personally I'd replace all of that with cmake --build ..
 
I can do it with gcc but not with cl
vsc + gcc has no problem.
cmake forces me to create a lot of boilplate.
By the way, I am reading "Clean C++ 20 Second Edition" by Stephan Roth. This book seems very well written. :-)
 
10:59 AM
Problem solved.
 
11:19 AM
2 messages moved from Lounge<C++>
 
11:52 AM
What are the relations between std::cout and std::basic_ostream?
https://en.cppreference.com/w/cpp/io/basic_ostream/write
#include <iostream>

int main()
{
int n = 0x41424344;
std::cout.write(reinterpret_cast<char*>(&n), sizeof n) << '\n';

char c[]="This is sample text.";
std::cout.write(c, 4).write("!\n", 2);
}
 
nwp
> [The global objects std::cout and std::wcout control output to a stream buffer of implementation-defined type (derived from std::streambuf)](https://en.cppreference.com/w/cpp/io/cout)
> [The I/O stream objects std::basic_istream and std::basic_ostream, as well as all objects derived from them (std::ofstream, std::stringstream, etc), are implemented entirely in terms of std::basic_streambuf.](https://en.cppreference.com/w/cpp/io/basic_streambuf)
Fuck murkdown.
 
 
4 hours later…
4:30 PM
It seems to me, gcc builds faster than cl.
 
4:45 PM
are you on the same OS, using the same build system?
because build system alone can make a huge difference
 
 
1 hour later…
5:57 PM
@Mgetz Yes. The same OS. But I am not sure what the same build system means.
 
msbuild vs. make vs. cmake etc
 
I don't use build system. I compile with the following task.json.
{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "gcc.exe BUILD",
			"command": "${env:MINGW_CPP}/gcc.exe",
			"args": [
				"${file}",
				"-o",
				"${fileBasenameNoExtension}.exe",
				"-I",
				"${env:OPENCV_DIR}/include",
				"-L",
				"${env:OPENCV_DIR}/x64/mingw/lib",
				"-llibopencv_world452",
				"-lstdc++"
			],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$gcc"
			]
		},
		{
			"label": "gcc.exe RUN",
			"command": "${fileBasenameNoExtension}.exe",
When building with cl.exe without Visual Studio but with VS Code, we have to open VS Code via Developer Command Prompt. It is a bit annoying.
 
 
1 hour later…
7:09 PM
@TheShortestMustacheTheorem you're shooting yourself in the foot, setup the normal cmake workflow
 
7:38 PM
@Mikhail I am still new to using CMAKE.
 

« first day (1808 days earlier)      last day (1045 days later) »