Time Nick Message 21:31 erlehmann how would new[] know how many objects are in the array? 21:31 erlehmann well i thought i do “char *p = new char[10];” and the magic happens 21:31 sfan5 did you even read the documentation I linked? 21:31 sfan5 just the function signature would be enough 21:32 sfan5 void* operator new ( std::size_t count ); 21:32 sfan5 void* operator new[]( std::size_t count ); 21:32 erlehmann ok 21:32 erlehmann what do the [] then mean if not syntactic sugar? 21:33 sfan5 grossly simplified the line you pasted is equivalent to "char *p = operator new[](sizeof(char) * 10);" 21:34 sfan5 where operator new[] is just a weirdly named function 21:34 erlehmann ok 21:34 sfan5 worth pointing out that initialization of the objects does not happen inside operator new[] 21:37 erlehmann i have to look into this more to understand it 21:48 erlehmann i rest 21:48 GNUHacker any optifine's like shaders 4 minetest? 22:21 erlehmann sfan5, before going to sleep: my understanding is that confusing delete and delete[] may result in heap corruption depending on whateve the implementation does behind the curtainr. i will hive to use a debugger. 22:21 erlehmann curtain 22:21 sfan5 it may result in anything 22:21 Hawk777 It can also result in destructors only being run on the first object in the array, even if the heap is actually kept intact; that is another possible outcome. Of course it’s UB so really anything can happen. 22:21 erlehmann uh 22:22 erlehmann if it's UB, then i definitely should stop looking how it's implemented 22:22 erlehmann as that doesn't help me understanding a thing 22:23 erlehmann thanks, both of you 22:23 Hawk777 “In the first alternative (delete object), the value of the operand of delete may be a null pointer value, a pointer to a ***non-array*** object created by a previous new-expression, or a pointer to a subobject (4.5) representing a base class of such an object (Clause 13). If not, the behavior is undefined.” so yeah, UB. 22:24 Hawk777 The next sentence says the same about the converse (delete[] must be used only on things made by new[]).