Re: errno in debug vs. release
Re: errno in debug vs. release
- Subject: Re: errno in debug vs. release
- From: Cameron Hayne <email@hidden>
- Date: Tue, 7 Feb 2006 18:12:22 -0500
On 7-Feb-06, at 5:10 PM, John W Noerenberg II wrote:
But malloc *is* supposed to set errno* if the size argument equals
zero.
I'm not sure where you are getting that from. I don't see it on the
man page.
And the following program works fine - as I think it should.
#include <stdio.h>
#include <stdlib.h>
#include <sys/errno.h>
int main()
{
char *ptr;
/* Set errno to something recognizable */
errno = 31415926;
printf("errno was set to %d\n", errno);
ptr = malloc(0);
if (ptr == NULL)
{
printf("malloc returned NULL, errno is %d\n", errno);
}
else
{
printf("malloc succeeded - returned %x, errno is %d\n", ptr, errno);
}
return 0;
}
--
Cameron Hayne
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden