RETURN VALUES
     If successful, calloc(), malloc(), realloc(), reallocf(), and valloc() 
functions return
     a pointer to allocated memory.  If there is an error, they return a NULL 
pointer and set
     errno to ENOMEM.

>> An implementation of malloc that never returns NULL is still compliant to 
>> the standard.

Have you tried checking errno after the malloc?
-Carl



> On Jul 4, 2016, at 7:13 PM, Dmitry Markman <dmark...@mac.com> wrote:
> 
> thanks
> 
> unfortunately you started to play with words
> 
> I asked for ~250TB of data from my MacBook Pro with 1TB SSD and 16GB of RAM
> 
> clearly that amount can’t be given (in any circumstances)
> 
> so if compiler returns something that isn’t NULL it’s very troubling
> 
> thanks again
> 
> dm
> 
> 
> 
>> On Jul 4, 2016, at 9:20 PM, Clark Cox <clarkc...@gmail.com> wrote:
>> 
>> 
>>> On Jul 4, 2016, at 15:53, Dmitry Markman <dmark...@mac.com> wrote:
>>> 
>>> Hmm
>>> 
>>> behavior you described is good receipt to un-robust software
>>> 
>>> IMHO, all talks about “effective", “typically" and so on and on is matter 
>>> of interpretation
>>> 
>>> and are much less important than standard
>> 
>> An implementation of malloc that never returns NULL is still compliant to 
>> the standard.
>> 
>>> first of all there is a standard and nothing more. In some cases standard 
>>> says that behavior is undefined
>>> 
>>> but in case of “malloc" and "operator new” everything is well defined
>> 
>> The standard says that malloc returns NULL in case of failure. It however, 
>> says nothing about what constitutes a failure, or *any* situations in which 
>> NULL must be returned..
>> 
>> 
>> 
>> -- 
>> Clark Smith Cox III
>> clarkc...@gmail.com
>> 
> 
> Dmitry Markman
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list      (Xcode-users@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/xcode-users/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to