Talk:Assert.h

Removed statements
Several points I noted about your recent removals: - you can add that back in without undoing the important changes - again you can add that in without undoing the important changes, though I really don't think it is an important detail. Also I think the example which I re-added does a much better job. - There is very little difference in the result on various compilers. ALL of them will do the assert and abort at the same time. IMHO this example does much much more in explaining things than all the text you seem to want to add. Also I HAD to undo a lot of mistakes, in particular about "compiling" (it will compile whether or not the assert will throw), and to change the program to one that will actually trigger an assert. - The fact that the expression is not evaluated when debugging is disabled is probably infinitely far more important than which compiler macro is used or what header file abort is in, so I am confused why you think that should not be there. The template stuff is an attempt to explain why static_assert showed up in C++ before it was in C. - Here was by far the biggest mistakes. You left tons on stuff about assert mixed in here (the C++ header file was one of those), duplicated stuff, and mangled the text so the fact that it is compile-time seemed to be only for C99 and not C++. Please do not change this unless you clearly keep on subject and only talk about static_assert! I understand having different mindsets about how to work an article, but everything I've stated is sourced, unless I'm overlooking something here. Perhaps you mean mistakes as in prose mistakes, rather than factual mistakes? elijahpepe@wikipedia (he/him) 03:55, 18 March 2023 (UTC)
 * The note was removed, which I find an odd change. is defined in stdlib.h
 * The bit about and  was removed. Again, odd, considering that those two preprocessor macros are used by . I looked over the statement I added again, just in case I had said that it returns it or something along those lines, but what's written to  is, in fact, those two preprocessor macros.
 * The example was changed and the result of compiling the example is provided. I don't see the use in providing what the program would compile to simply because there are multiple different compilers and operating systems, and I prefer to keep pages free of code blocks (especially console outputs).
 * Several sentences, such as "Notice that this does not execute the expression, relying on side-effects of the assert expression is a common mistake" and "Originally this was done with template hacks (which are impossible in C), but all modern compilers provide direct support for this" lack references and, in the case of the former, read more as guides than an actual page. I should have mentioned that negates assert.h as the example in there was ambiguous to a beginner, but I disagree with how you wrote this sentence. To fit with the encyclopedic theme, perhaps something like, " results in the  macro to not be executed."
 * A huge chunk of the part about was removed. I'll admit that I omitted the compile-time portion (for C++) on accident, I had intended to include it but completely forgot to. I don't see why reverting an entire edit over that is justified. I looked over some of the changes and everything makes sense.  does require a constant expression (contextually) that can be converted into a Boolean, such as a comparison, and a string literal (until C++17). Working with these articles is rather difficult because all changes to how a declaration works need to be expressed, such as C++17 no longer requiring a string literal as the message. Still, I mentioned that (albeit after the fact, as not everyone uses C++17). I also don't see why the part about  and assert.h had to be moved and removed respectively. Personally, I use the former, but both are fair to mention as C++ allows for the latter for interoperability (and I'm not willing to have a debate over whether it should be included, it's important to the article's topic).
 * Your changes turned at least one paragraph into a sentence, and there are several other short paragraphs.
 * Yes because the big paragraph duplicated information, contained completely erroneous statements, and merged multiple subjects (don't talk about assert in a section titled static_assert, for one thing!).Spitzak (talk) 15:52, 18 March 2023 (UTC)
 * I can't seem to find any such duplicated information that you're talking about. elijahpepe@wikipedia (he/him) 16:57, 18 March 2023 (UTC)

In C99, the assert macro explicitly allows any scalar type.
Can anybody explain what this means? I am suspicious this is a meaningless statement from the Linux man page that people keep copying, and that all the "new types" are in C99 anyway and therefore the C89 assert was capable of doing every type that could work. Is there an example of something that did not work in C89 assert statement that should? What are these types that are "scalar" but cannot be cast to int? Spitzak (talk) 19:37, 19 March 2023 (UTC)
 * There's no difference, but the distinction should still be noted as part of changes made to the macro. elijahpepe@wikipedia (he/him) 21:52, 19 March 2023 (UTC)