[Issue 11254] std.string.strip is not nothrow

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 14 05:55:13 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11254


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |monarchdodra at gmail.com
         Resolution|                            |INVALID


--- Comment #1 from monarchdodra at gmail.com 2013-10-14 05:55:11 PDT ---
(In reply to comment #0)
> import std.string: strip;
> void main() nothrow {
>     " hello ".strip;
> }
> 
> 
> 
> dmd 2.064beta gives:
> 
> test.d(3): Error: 'std.string.strip!(immutable(char)).strip' is not nothrow
> test.d(2): Error: function 'D main' is nothrow yet may throw
> 
> 
> I don't know if this can be done. Often string functions need to decode UTF,
> and this could raise exceptions. In most cases, or for ASCII strings, a strip
> can't throw exceptions.
> 
> If this can't be done then please close down this issue.

strip is a unicode aware function, that can remove unicode whites, so it *must*
decode. So even if "most of the time", it won't throw, in the generic case, it
can.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list