Click here to Skip to main content
15,561,246 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: C++ is love Pin
Member 1330167915-Dec-20 1:14
Member 1330167915-Dec-20 1:14 
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 2:13
mvahoney the codewitch15-Dec-20 2:13 
GeneralRe: C++ is love Pin
Member 1330167915-Dec-20 3:12
Member 1330167915-Dec-20 3:12 
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 3:20
mvahoney the codewitch15-Dec-20 3:20 
GeneralRe: C++ is love Pin
Mladen Janković15-Dec-20 16:16
Mladen Janković15-Dec-20 16:16 
GeneralRe: C++ is love Pin
Mladen Janković15-Dec-20 15:30
Mladen Janković15-Dec-20 15:30 
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 15:36
mvahoney the codewitch15-Dec-20 15:36 
GeneralRe: C++ is love Pin
Mladen Janković15-Dec-20 15:46
Mladen Janković15-Dec-20 15:46 
1) you don't want to introduce bunch of names from std into client's scope, can cause all kind of nasty problems for users. C++ name lookup is complex as it is.
2) if I got a pointer to MemoryPool and tried to delete the referenced object, I would invoke undefined behavior, even thought virtual methods are strongly suggesting me that I should be able to do it

Some more points, since you said C++ is love:

4) virtual void* alloc(const size_t size)=0; - const is needless
5) if(!TCapacity) will give you a warning (on /W4 maybe) if TCapacity is 0, but
6) the bigger problem is uint8_t m_heap[TCapacity], since zero-sized arrays is not standard C++

So I would either go with static_assert and ensure that 0 is not valid value or make specialization for that cas.
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 18:06
mvahoney the codewitch15-Dec-20 18:06 
GeneralRe: C++ is love Pin
Mladen Janković16-Dec-20 2:28
Mladen Janković16-Dec-20 2:28 
GeneralRe: C++ is love Pin
Mladen Janković15-Dec-20 16:04
Mladen Janković15-Dec-20 16:04 
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 18:07
mvahoney the codewitch15-Dec-20 18:07 
GeneralRe: C++ is love Pin
Mladen Janković16-Dec-20 1:27
Mladen Janković16-Dec-20 1:27 
GeneralRe: C++ is love Pin
honey the codewitch16-Dec-20 1:32
mvahoney the codewitch16-Dec-20 1:32 
GeneralRe: C++ is love Pin
Mladen Janković16-Dec-20 2:13
Mladen Janković16-Dec-20 2:13 
GeneralRe: C++ is love Pin
honey the codewitch16-Dec-20 2:19
mvahoney the codewitch16-Dec-20 2:19 
JokeRe: C++ is love Pin
Slacker00714-Dec-20 11:33
professionalSlacker00714-Dec-20 11:33 
GeneralRe: C++ is love Pin
honey the codewitch14-Dec-20 18:08
mvahoney the codewitch14-Dec-20 18:08 
GeneralRe: C++ is love Pin
den2k8814-Dec-20 22:48
professionalden2k8814-Dec-20 22:48 
GeneralRe: C++ is love Pin
Slacker00715-Dec-20 0:02
professionalSlacker00715-Dec-20 0:02 
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 2:15
mvahoney the codewitch15-Dec-20 2:15 
GeneralRe: C++ is love Pin
Slacker00715-Dec-20 4:11
professionalSlacker00715-Dec-20 4:11 
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 4:20
mvahoney the codewitch15-Dec-20 4:20 
GeneralRe: C++ is love Pin
Randor 14-Dec-20 10:27
professional Randor 14-Dec-20 10:27 
GeneralRe: C++ is love Pin
honey the codewitch14-Dec-20 10:50
mvahoney the codewitch14-Dec-20 10:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.