Jump to content

User talk:Dampam

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by NicM (talk | contribs) at 06:43, 22 July 2008. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Welcome!

Hello, Dampam, and welcome to Wikipedia! Thank you for your contributions. I hope you like the place and decide to stay. Here are some pages that you might find helpful:

I hope you enjoy editing here and being a Wikipedian! Please sign your messages on discussion pages using four tildes (~~~~); this will automatically insert your username and the date. If you need help, check out Wikipedia:Questions, ask me on my talk page, or ask your question on this page and then place {{helpme}} before the question. Again, welcome! RJFJR (talk) 15:31, 10 July 2008 (UTC)[reply]

malloc

Please stop reverting my changes to this article; if you think they are incorrect please explain and fix only those parts which are incorrect - "learn C" is not a suitable justification, particularly from someone who thinks realloc(ptr, 0) is the same as free(ptr). NicM (talk) 06:14, 22 July 2008 (UTC).[reply]

You may want to take a look at the C99 draft 7.20.3.4, there is no mention of the behaviour you describe (returning NULL when size == 0); you can confirm this as implemented on some systems - realloc(ptr, 0) will return a pointer, not NULL. NicM (talk) 06:41, 22 July 2008 (UTC).[reply]
Also, I had another look at the C99 draft, and I can't see where ptr = 0; printf("%p", (void *) ptr); is UB. The printf section clearly says the pointer representation is converted in an implementation-defined manner (without any caveats about NULL) and I don't see anything about varardics to make it UB (although I could be missing it). I have removed this line from the article until you confirm with a cite - it is unobvious so we will probably want to add the cite to the article, so an online link would be best if possible. NicM (talk) 06:41, 22 July 2008 (UTC).[reply]
Whoops, I'm an idiot, I completely misread the code. Doh. Sorry, I have restored this line. NicM (talk) 06:43, 22 July 2008 (UTC).[reply]