Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
3 votes
1 answer
221 views

I'm exploring OpenGL with Qt6, and I came across some of their examples. The thing that draws my attention from a C++ perspective is the following piece of code. delete m_program; // <-- is this ...
CroCo's user avatar
  • 5,889
2 votes
2 answers
257 views

The CPPReference page on reinterpret_cast mentions possible multiple distinct values of std::nullptr_t. The page for that doesn't rule that out, but also doesn't explain what such a value might be. I ...
schuelermine's user avatar
  • 2,389
6 votes
1 answer
129 views

Is it prohibited to use std::bit_cast for conversion to or from std::nullptr_t = decltype(nullptr) type? And if it is permitted, 1) must the result of std::bit_cast be the same as static_cast, 2) must ...
4 votes
1 answer
99 views

When using decltype(auto) as return type of a template function that is supposed to return a pointer, I've got an issue when this function can return a valid address or nullptr. Here is an example: ...
4 votes
1 answer
176 views

I just found out that std::is_pointer_v<nullptr> translates to false, thats why the code below: template <typename T> std::string_view type_str() { /* returns the name of the type */ } ...
1 vote
2 answers
171 views

I'm reading the C document n3042 Introduce the nullptr constant and when it enumerates the properties of nullptr there is the following: In memory, nullptr is represented with the same bit-pattern as ...
1 vote
1 answer
302 views

My Goal is to replicate a TArray<UHealthComponent*> in a ListenServer configuration for 2 players For more context the TArray is inside of an ActorComponent named ShipStats attached to the ...
0 votes
0 answers
327 views

Is NULL fully interchangeable with nullptr in C23? Are they used in separate scenarios? I'm coding a game, and there are moments where I've used NULL and others where I've used nullptr. I initially ...
1 vote
2 answers
197 views

I'm working through a c++ course and currently covering checking for nullptr's. The suggested code is: int* p{}; if(!(p==nullptr)){ etc, etc But I'm not sure why I can't say (which seems slightly ...
14 votes
3 answers
1k views

I wrote a function with two overloads - one for a single pointer and one for a vector of pointers. At some point in the code I wanted to pass an empty vector to the function and used {} as the ...
0 votes
0 answers
71 views

ALL, Using MSVC 2017. When I had the code like this: class Foo { private: LibraryObject *m_library; }; my code compiled fine. But when I tried to do it like this: class Foo { private: std::...
Igor's user avatar
  • 6,486
4 votes
1 answer
472 views

I've been playing around with C23's new features and I came across nullptr, and I'd like to use it in place of NULL where possible, or at least in demo code to better understand proper usage. Here is ...
jitters's user avatar
  • 61
-1 votes
1 answer
114 views

When using a singly-linked list, I've been suggested to use "if x != nullptr" but I don't understand why this works. In my example code, the first and second print statements work, but as ...
1 vote
3 answers
355 views

In this answer to this question, it was noted that: If you're going to 'clear' the pointer in the dtor, a different idiom would be better - set the pointer to a known bad pointer value. and also ...
7 votes
2 answers
207 views

The expresssion (void *)0 is called a null pointer. But how about the following: int i = 0; void *s = (void *)i; Is s also a null-pointer? The C-language standard says: 6.3.2.3 Pointers 3 An integer ...

15 30 50 per page
1
2 3 4 5
...
25

AltStyle によって変換されたページ (->オリジナル) /