Quantcast
Channel: User Peter - Reinstate Monica - Stack Overflow
Browsing index pages (361 articles)
↧

Comment by Peter - Reinstate Monica on Undefined references to c23 variants

@3CEZVQ I would expect gcc (i.e., the compile/link driver) to choose the proper glibc automatically. Maybe a -std=c23 would trigger that? Although it seems inconsistent that the compiler compiles...

View Article


Comment by Peter - Reinstate Monica on Error return values vs. function that...

Ironically, the really unrecoverable errors may not allow you to even log anything (e.g. out-of-memory, memory corruption). For all others, it would often be nice to have context for the error (like,...

View Article


Comment by Peter - Reinstate Monica on File pointer in C programming

@mtilsted The return value of fopen() (as opposed to the return value of open()) is very well a "pointer in the C language" -- as well as a "magic token" (which we would normally call a "handle").

View Article

Comment by Peter - Reinstate Monica on Overloading function template with...

Not sure what happens if and when this question is closed...

View Article

Answer by Peter - Reinstate Monica for Is a directory in a file system just a...

Directories typically have a material presence on disk. In early Unix, which probably introduced the clearest concept of file systems with a tree-shaped directory structure, directories were actually...

View Article


Comment by Peter - Reinstate Monica on C: How to fold a constant before it is...

I wonder whether there may be constexpr possibilities in C++. std::to_string() does not appear to be.

View Article

Answer by Peter - Reinstate Monica for What happens if i mix c with c++ in a...

It is simple: Everything that you present to a C++ compiler must be valid C++.Not coincidentally though, most C — including its standard library (for things like printf) — is actually valid C++ as well...

View Article

Comment by Peter - Reinstate Monica on Parts of the stack frame in Visual...

Not sure about the close reason -- I posted it because it's clearly useful as a reference for future users. I also think it's not better suited for, say, superuser or such. Stackoverflow is the proper...

View Article


Comment by Peter - Reinstate Monica on What are the differences between...

@dancarter Well, VS Code integrates everything except a compiler and debugger ;-). Which leaves ... an editor. As advertised. To make this DE an IDE you have to add the "I" yourself, so to speak...

View Article


Comment by Peter - Reinstate Monica on Parts of the stack frame in Visual...

@TylerH Especially the fact that there is no (obvious) warning about this. Btw., at least for a sample size of 1, killing the devenv process during a build does not leave the compiler processes behind.

View Article

Answer by Peter - Reinstate Monica for What happens if i mix c with c++ in a...

It is simple: Everything that you present to a C++ compiler must be valid C++.Not coincidentally though, most C — including its standard library (for things like printf) — is actually valid C++ as well...

View Article

Comment by Peter - Reinstate Monica on How can I avoid "for" loops with an...

@CodyGray Seriously: Coders should be paid by lines deleted -- that would be a better metric than most and lead to better software, in most cases.

View Article

Comment by Peter - Reinstate Monica on Why should I not #include ?

IIUC, gcc uses a precompiled version; as an effect, it may be faster than including only the needed single headers (although those could be precompiled as well).

View Article


Comment by Peter - Reinstate Monica on Is repository size really a Git...

Often, there is a central repository on a company server or some cloud git provider. Often, it is tolerable when these repos become large -- the main pain is that every local "working clone" is that...

View Article

Comment by Peter - Reinstate Monica on When should I use std::thread::detach?

@Andrew You are being sarcastic, right?

View Article


Comment by Peter - Reinstate Monica on Does p-- point to b in this code, or...

There is no problem with using namespace std in a short demo program like this. It's the first thing I do because it makes the program more readable, which is paramount here.

View Article

Comment by Peter - Reinstate Monica on What do fgetc and fputc have to do...

It should not be too much effort to write a toy toy program which does something trivial (but observable) with the data each way so that you get a rough idea. Presumably with optimization enabled to...

View Article


Answer by Peter - Reinstate Monica for Accessing static properties of a...

The straight-forward way is apparently a grey area in the language specification:struct Example{ static int example() { return 0; }};typedef Example* PointerType;int main(){ PointerType p = nullptr; //...

View Article

Answer by Peter - Reinstate Monica for How define an array of function...

There are a number of correct answers here; but they fail to mention the beautiful simplicity of the C grammar which, once understood, helps solving question like this one.1. Declarations syntactically...

View Article

Answer by Peter - Reinstate Monica for How change every struct in an array of...

As dbush said: The more typical case, and probably what you (don't know you) want is an array of objects, not only pointers to objects:#include <stdio.h>#include <stdlib.h>struct Person {...

View Article
Browsing index pages (361 articles)


Latest Images