Thread overview
[Issue 16519] toHexString always returns stack allocated string
Sep 21, 2016
Johan Engelen
Feb 27, 2018
Seb
Mar 03, 2018
Walter Bright
Mar 20, 2018
anonymous4
Dec 30, 2019
berni44
Dec 17, 2022
Iain Buclaw
September 21, 2016
https://issues.dlang.org/show_bug.cgi?id=16519

Johan Engelen <jbc.engelen@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal

--- Comment #1 from Johan Engelen <jbc.engelen@gmail.com> ---
https://forum.dlang.org/thread/mtlvuhoiqsfqzgurreld@forum.dlang.org


So not a bug maybe, but something very nasty. Please adjust the API or (greatly) expand the documentation.

--
September 21, 2016
https://issues.dlang.org/show_bug.cgi?id=16519

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@yahoo.com
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=12625

--- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> ---
The underlying issue is the allowance to slice a static array RValue, which can never be valid. This is issue 12625.

Now, we may fix this, and then what happens is that your code that compiled before now doesn't compile with the same message as the "bad" version. But that's not good either. toHexString should work on a static array without creating another static array.

So I'll leave this bug open.

--
February 27, 2018
https://issues.dlang.org/show_bug.cgi?id=16519

Seb <greensunny12@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greensunny12@gmail.com

--- Comment #3 from Seb <greensunny12@gmail.com> ---
FWIW -dip1000 warns about this problem:

foo.d(8): Deprecation: slice of static array temporary returned by
toHexString(hash) assigned to longer lived variable a

but I still think we should do something about the API.

--
March 03, 2018
https://issues.dlang.org/show_bug.cgi?id=16519

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe
                 CC|                            |bugzilla@digitalmars.com

--
March 20, 2018
https://issues.dlang.org/show_bug.cgi?id=16519

--- Comment #4 from anonymous4 <dfj1esp02@sneakemail.com> ---
(In reply to Seb from comment #3)
> foo.d(8): Deprecation: slice of static array temporary returned by
> toHexString(hash) assigned to longer lived variable a
> 
> but I still think we should do something about the API.

Slicing a temporary and storing it anywhere should be deprecated in unsafe code too. It should be valid to only pass it as a function argument.

--
December 30, 2019
https://issues.dlang.org/show_bug.cgi?id=16519

berni44 <bugzilla@d-ecke.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@d-ecke.de

--- Comment #5 from berni44 <bugzilla@d-ecke.de> ---
(In reply to Steven Schveighoffer from comment #2)
> toHexString should work on a static array without
> creating another static array.
> 
> So I'll leave this bug open.

What's wrong with this?

(In reply to Seb from comment #3)
> FWIW -dip1000 warns about this problem:
> 
> foo.d(8): Deprecation: slice of static array temporary returned by
> toHexString(hash) assigned to longer lived variable a

Can't find any information on when this deprecation cycle will end. Do you know?

--
December 30, 2019
https://issues.dlang.org/show_bug.cgi?id=16519

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=20472

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=16519

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--