[Issue 3057] Add pure annotations to core.stdc.*
https://issues.dlang.org/show_bug.cgi?id=3057 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Version|2.030 |D2 --
[Issue 3057] Add pure annotations to core.stdc.*
http://d.puremagic.com/issues/show_bug.cgi?id=3057 Alex R�nne Petersen a...@lycus.org changed: What|Removed |Added Status|NEW |RESOLVED CC||a...@lycus.org Resolution||FIXED --- Comment #13 from Alex R�nne Petersen a...@lycus.org 2012-10-10 03:35:57 CEST --- I sent a pull request a while back that added safety, purity, and nothrow annotations throughout core.stdc (not having noticed the patch here). I'll close this, but if it turns out I forgot some annotations, please reopen. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3057] Add pure annotations to core.stdc.*
http://d.puremagic.com/issues/show_bug.cgi?id=3057 --- Comment #11 from Sobirari Muhomori ma...@pochta.ru 2009-06-23 05:33:46 PDT --- Reference type is an example of global state in the sense that it can change unexpectedly. Dependency on global state is impure because it prevents reordering of function calls and caching function results. My example demonstrates, why strlen calls can't be reordered or cached, which proves its impurity. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3057] Add pure annotations to core.stdc.*
http://d.puremagic.com/issues/show_bug.cgi?id=3057 --- Comment #12 from Sobirari Muhomori ma...@pochta.ru 2009-06-23 05:47:40 PDT --- strlen is a classic example of a pure function because classic strings are immutable which is not the case for C strings and strlen. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3057] Add pure annotations to core.stdc.*
http://d.puremagic.com/issues/show_bug.cgi?id=3057 --- Comment #9 from Sobirari Muhomori ma...@pochta.ru 2009-06-11 04:19:22 PDT --- assert(str1!=str2,pwnd); *fixed -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3057] Add pure annotations to core.stdc.*
http://d.puremagic.com/issues/show_bug.cgi?id=3057 --- Comment #8 from Sobirari Muhomori ma...@pochta.ru 2009-06-11 04:17:10 PDT --- char* str1=obj.str1; const char* str2=obj.str2; auto len1=strlen(str2); str1[0]=0; auto len2=strlen(str2); assert(str1==str2,pwnd); GCC has stricter definition of pure function - a function whose arguments are contained in the stack (no reference types), in D this definition is extended to include immutable reference types, because they effectively behave as value types. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3057] Add pure annotations to core.stdc.*
http://d.puremagic.com/issues/show_bug.cgi?id=3057 --- Comment #6 from Sobirari Muhomori ma...@pochta.ru 2009-06-10 02:58:39 PDT --- String functions are also impure because their arguments can be mutable. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3057] Add pure annotations to core.stdc.*
http://d.puremagic.com/issues/show_bug.cgi?id=3057 Don clugd...@yahoo.com.au changed: What|Removed |Added CC||clugd...@yahoo.com.au --- Comment #3 from Don clugd...@yahoo.com.au 2009-06-08 17:45:49 PDT --- (In reply to comment #0) Created an attachment (id=395) -- (http://d.puremagic.com/issues/attachment.cgi?id=395) [details] Add pure annotations throughout std.core.* I did a quick pass through core.stdc.* to annotate the functions I believe should be pure. I added some comments for several that could be stretched to be pure if we're a little looser with the definition of pure. I skipped over the floating point areas as there's been a good amount of debate that I haven't followed over what to do with them. I defer to Don and Walter on those. Almost all functions in stdc.math cannot possibly be pure, because they set the global 'errno'. (This is part of the reason why it has been worthwhile to re-implement most C math functions in D). There are a few functions (like fpclassify() and the trivial functions which use it) which _could_ legally be marked as pure, but I really don't think that use of stdc.math should be encouraged in any way in D code. So the math stuff is not a TODO list thing, it should stay as impure. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3057] Add pure annotations to core.stdc.*
http://d.puremagic.com/issues/show_bug.cgi?id=3057 --- Comment #1 from Brad Roberts bra...@puremagic.com 2009-06-07 14:59:13 PDT --- (From update of attachment 395) note: I varied the style used to annotate some parts to get a feel for how they looked. A second pass should be done to choose a common style. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---