Click here to Skip to main content
15,887,027 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: malloc and calloc revisited - oh hum but pay attention when using them Pin
Daniel Pfeffer19-Dec-22 21:01
professionalDaniel Pfeffer19-Dec-22 21:01 
GeneralRe: malloc and calloc revisited - oh hum but pay attention when using them Pin
jmaida20-Dec-22 5:58
jmaida20-Dec-22 5:58 
GeneralRe: malloc and calloc revisited - oh hum but pay attention when using them Pin
k505420-Dec-22 7:52
mvek505420-Dec-22 7:52 
GeneralRe: malloc and calloc revisited - oh hum but pay attention when using them Pin
jmaida20-Dec-22 10:13
jmaida20-Dec-22 10:13 
GeneralRe: malloc and calloc revisited - oh hum but pay attention when using them Pin
Bruno van Dooren20-Dec-22 11:08
mvaBruno van Dooren20-Dec-22 11:08 
GeneralRe: malloc and calloc revisited - oh hum but pay attention when using them Pin
jmaida20-Dec-22 12:00
jmaida20-Dec-22 12:00 
GeneralRe: malloc and calloc revisited - oh hum but pay attention when using them Pin
megaadam20-Dec-22 0:09
professionalmegaadam20-Dec-22 0:09 
GeneralRe: malloc and calloc revisited - oh hum but pay attention when using them Pin
Daniel Pfeffer20-Dec-22 6:37
professionalDaniel Pfeffer20-Dec-22 6:37 
megaadam wrote:
Since the result of malloc(wanted) for wanted==0 is undefined (across platforms)

When discussing Standards, we must use the correct terms. The C Standard differentiates between Undefined Behaviour and Implementation Defined Behaviour.

Undefined Behaviour means precisely that. The implementation is within its rights to do anything - format your disk, set fire to your cat, or make demons fly out of your nose. Avoid at all costs!

Implementation-Defined Behaviour means that the implementation may choose between a few different implementations listed in the Standard, the choice being documented in those manuals that nobody ever reads ( Smile | :) ). The behaviour of malloc(0) is one of these. One should attempt to avoid these in the interest of writing portable code, but they are sometimes necessary.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.

GeneralRe: malloc and calloc revisited - oh hum but pay attention when using them Pin
megaadam20-Dec-22 6:55
professionalmegaadam20-Dec-22 6:55 
GeneralRe: malloc and calloc revisited - oh hum but pay attention when using them Pin
englebart21-Dec-22 5:15
professionalenglebart21-Dec-22 5:15 
GeneralRe: malloc and calloc revisited - oh hum but pay attention when using them Pin
jmaida21-Dec-22 14:06
jmaida21-Dec-22 14:06 
GeneralWordle 549 Pin
StarNamer@work19-Dec-22 13:37
professionalStarNamer@work19-Dec-22 13:37 
GeneralRe: Wordle 549 Pin
Amarnath S19-Dec-22 13:44
professionalAmarnath S19-Dec-22 13:44 
GeneralRe: Wordle 549 Pin
Shane010319-Dec-22 16:48
Shane010319-Dec-22 16:48 
GeneralRe: Wordle 549 Pin
Peter_in_278019-Dec-22 18:04
professionalPeter_in_278019-Dec-22 18:04 
GeneralRe: Wordle 549 Pin
Sander Rossel19-Dec-22 19:32
professionalSander Rossel19-Dec-22 19:32 
GeneralRe: Wordle 549 Pin
den2k8819-Dec-22 21:02
professionalden2k8819-Dec-22 21:02 
GeneralRe: Wordle 549 2/6 Pin
jmaida20-Dec-22 12:32
jmaida20-Dec-22 12:32 
GeneralRe: Wordle 549 Pin
OriginalGriff19-Dec-22 21:07
mveOriginalGriff19-Dec-22 21:07 
GeneralRe: Wordle 549 Pin
pkfox19-Dec-22 21:30
professionalpkfox19-Dec-22 21:30 
GeneralRe: Wordle 549 Pin
OriginalGriff19-Dec-22 21:48
mveOriginalGriff19-Dec-22 21:48 
GeneralRe: Wordle 549 Pin
pkfox19-Dec-22 21:58
professionalpkfox19-Dec-22 21:58 
GeneralRe: Wordle 549 Pin
pkfox19-Dec-22 21:29
professionalpkfox19-Dec-22 21:29 
GeneralRe: Wordle 549 Pin
ChandraRam19-Dec-22 21:53
ChandraRam19-Dec-22 21:53 
GeneralRe: Wordle 549 (3/6) Pin
musefan20-Dec-22 4:00
musefan20-Dec-22 4:00 

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.