char e string em linguagem D

Basile B. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 13 15:36:47 PDT 2017


On Thursday, 13 July 2017 at 22:30:29 UTC, crimaniak wrote:
> On Thursday, 13 July 2017 at 21:49:40 UTC, dark777 wrote:
>   char[] stalman()
>   {
>       return cast(char[])`
>                   ((__-^^-,-^^-__))
>                    *---*******---*
>                     *--|o   o|--*
>                        \     /
>                         ): :(
>                         (o_o)
>                           -
>                  https://www.gnu.org
>
> `;
>   }


Never cast a literal to char[]. modifying the resulting char[] 
will lead to AV, at least under linux.  `.dup` the literal if you 
really needs char[].


More information about the Digitalmars-d-learn mailing list