[TUHS] Minimum Array Sizes in 16 bit C (was Maximum)
    Ralph Corderoy 
    ralph at inputplus.co.uk
       
    Mon Sep 30 01:17:11 AEST 2024
    
    
  
Hi Werner,
> > malloc(0) isn't undefined behaviour but implementation defined.
>
> In modern C there is no difference between those two concepts.
Can you explain more about your view or give a link if it's an accepted
opinion.  I'm used to an implementation stating its choices from those
given by a C standard, e.g.
    (42) Whether the calloc, malloc, realloc, and aligned_alloc functions
         return a null pointer or a pointer to an allocated object when
         the size requested is zero (7.24.3).
I'd call malloc(0) and know it's not undefined behaviour but one of
those choices.
-- 
Cheers, Ralph.
    
    
More information about the TUHS
mailing list