DMD 0.177 release
Alexander Panek
a.panek at brainsware.org
Sat Dec 9 08:42:56 PST 2006
Chris Miller wrote:
> On Sat, 09 Dec 2006 11:33:17 -0500, Alexander Panek
> <a.panek at brainsware.org> wrote:
>
>> char *newCharz( uint size ) {
>> return (new char [size]).ptr;
>> }
>>
>> char *p = newCharz(32);
>>
>> :P
>>
>> I like the explicity.
>
> Well, I'm not sure what it should be, but you already made a mistake: it
> should be size_t instead of uint ;)
>
> Plus, I never said it was a zero-terminated string.
Oi. Sorry:
char * toChars( size_t size ) {
return (new char[size]).ptr;
}
char * toCharz( size_t size ) {
return (new char[size + 1]).ptr;
}
Better? :P
>
>>
>> Chris Miller wrote:
>>> char* p = new char[32];
>>> Error: cannot implicitly convert expression (new char[](32)) of type
>>> char[] to char*
>>> Should this be a special case? Currently it needs (new char[32]).ptr
>
More information about the Digitalmars-d-announce
mailing list