Click here to Skip to main content
15,887,485 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 0:14
Member 1330167915-Dec-20 0:14 
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 1:13
mvahoney the codewitch15-Dec-20 1:13 
GeneralRe: C++ is love Pin
Member 1330167915-Dec-20 2:12
Member 1330167915-Dec-20 2:12 
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 2:20
mvahoney the codewitch15-Dec-20 2:20 
GeneralRe: C++ is love Pin
Mladen Janković15-Dec-20 15:16
Mladen Janković15-Dec-20 15:16 
GeneralRe: C++ is love Pin
Mladen Janković15-Dec-20 14:30
Mladen Janković15-Dec-20 14:30 
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 14:36
mvahoney the codewitch15-Dec-20 14:36 
GeneralRe: C++ is love Pin
Mladen Janković15-Dec-20 14:46
Mladen Janković15-Dec-20 14: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 17:06
mvahoney the codewitch15-Dec-20 17:06 
GeneralRe: C++ is love Pin
Mladen Janković16-Dec-20 1:28
Mladen Janković16-Dec-20 1:28 
GeneralRe: C++ is love Pin
Mladen Janković15-Dec-20 15:04
Mladen Janković15-Dec-20 15:04 
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 17:07
mvahoney the codewitch15-Dec-20 17:07 
GeneralRe: C++ is love Pin
Mladen Janković16-Dec-20 0:27
Mladen Janković16-Dec-20 0:27 
GeneralRe: C++ is love Pin
honey the codewitch16-Dec-20 0:32
mvahoney the codewitch16-Dec-20 0:32 
GeneralRe: C++ is love Pin
Mladen Janković16-Dec-20 1:13
Mladen Janković16-Dec-20 1:13 
GeneralRe: C++ is love Pin
honey the codewitch16-Dec-20 1:19
mvahoney the codewitch16-Dec-20 1:19 
JokeRe: C++ is love Pin
Slacker00714-Dec-20 10:33
professionalSlacker00714-Dec-20 10:33 
GeneralRe: C++ is love Pin
honey the codewitch14-Dec-20 17:08
mvahoney the codewitch14-Dec-20 17:08 
GeneralRe: C++ is love Pin
den2k8814-Dec-20 21:48
professionalden2k8814-Dec-20 21:48 
GeneralRe: C++ is love Pin
Slacker00714-Dec-20 23:02
professionalSlacker00714-Dec-20 23:02 
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 1:15
mvahoney the codewitch15-Dec-20 1:15 
GeneralRe: C++ is love Pin
Slacker00715-Dec-20 3:11
professionalSlacker00715-Dec-20 3:11 
GeneralRe: C++ is love Pin
honey the codewitch15-Dec-20 3:20
mvahoney the codewitch15-Dec-20 3:20 
GeneralRe: C++ is love Pin
Randor 14-Dec-20 9:27
professional Randor 14-Dec-20 9:27 
GeneralRe: C++ is love Pin
honey the codewitch14-Dec-20 9:50
mvahoney the codewitch14-Dec-20 9: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.