User talk:Dampam

Welcome!

Hello,, 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 Questions, ask me on, or ask your question on this page and then place  before the question. Again, welcome! RJFJR (talk) 15:31, 10 July 2008 (UTC)
 * The five pillars of Wikipedia
 * Tutorial
 * How to edit a page
 * How to write a great article
 * Manual of Style

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).
 * 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).
 * 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).
 * Whoops, I'm an idiot, I completely misread *ptr = 0 as ptr = 0 (despite the bloody great comment saying "Undefined behavior"). Doh. Sorry, I have restored this line. NicM (talk) 06:43, 22 July 2008 (UTC).

I'm sorry, I don't really understand how wikipedia works, so this might not look correct. But you need to look at the standard before you try to correct me. ISO 9899:1999 TC3 7.20.3.2 The free function verse 2, [..] or if the space has been deallocated by a call to free or realloc, the behavior is undeﬁned.

Clearly realloc can free memory. That's possible when size is equal to zero. Dampam (talk) 09:54, 22 July 2008 (UTC)
 * What the article said was that free(ptr) is equivalent to realloc(ptr, 0) which returns NULL. 7.20.3 says: "If the size of the space requested is zero, the behavior is implementation-defined: either a null pointer is returned, or the behavior is as if the size were some nonzero value, except that the returned pointer shall not be used to access an object." So, in the latter case a pointer to a 0-sized block; I think 7.20.3.2 which you cite refers to the former case (where realloc does return NULL). Although I can't see where it specifies what happens to the block when it returns NULL (freed or not freed), but I may have missed it.
 * Note that glibc's realloc(3) specifies either behaviour ("If size was equal to 0, either NULL or a pointer suitable to be passed to free is returned.") and the OpenBSD libc returns a 0-sized allocation ("If size is zero and ptr is not a null pointer, the object it points to is freed and a new zero size object is returned."). Not that I am implying they are necessarily conformant, the standard is of course canonical.
 * I understand you are new to Wikipedia, and I don't mean to be rude, but please try to be constructive; this means (among other things) just because someone has made a mistake in one change it is not necessary to revert all their changes, also please resist the temptation to abuse people or denigrate their knowledge, even if they happen to be wrong (yes, I find it hard not to be dismissive in edit summaries too :-/). It is great that you want to improve C articles, but you will have to deal with a lot of non-experts. Please see WP:CIVIL, WP:AGF, WP:CON and so on. NicM (talk) 18:20, 22 July 2008 (UTC).


 * OK. Sorry for this but for some reason I got offended when you first editted my article, perhaps because as I've said before, I'm new to wikipedia.
 * Dampam (talk) 08:24, 23 July 2008 (UTC)

Here is my rationale for saying that malloc is not typesafe. There is no compiler-enforced type check when calling malloc. With new, if one tries: char *foo = new float; An error is issued. However, if one tries char *foo = malloc(sizeof(float)); No error is issued. That's the definition of lack of type safety. Please justify your comment, and in the future I would appreciate if your summaries are less inflammatory. Thank you. Reinderientalk/contribs 00:02, 27 July 2008 (UTC)

Smackbot
Instead of calling this software a "piece of crap", perhaps you should have taken the time to read what exactly the bot does and why, and to report a false positive on the bot's talk page. In this case, the bot converted the underscore to a space for valid URI formatting reasons. Please make an effort to perform constructive criticism and help the community rather than slander it. Please read (or re-read) WP:CIVIL. Thank you. Reinderientalk/contribs 16:38, 29 July 2008 (UTC)

Civility
Hi there. I'm happy that you're becoming an active part of the editor community, but I've noticed that your summaries remain inflammatory and discourteous, including the recent one on Tay Zonday. I ask that you please adhere to WP:CIVIL or I'll feel the need to sort it out on the Wikiquette Alerts board. Thank you. Reinderientalk/contribs 04:59, 4 August 2008 (UTC)
 * I get angry with all the spam... sorry. Dampam (talk) 22:47, 4 August 2008 (UTC)