Yet another "static" confusion
Lubos Pintes
lubos.pintes at gmail.com
Wed Feb 20 00:03:49 PST 2013
Hi,
I want to allocate a buffer which I use in a function which reads data
from socket.
So I did as a first line in that function:
static char[] buffer=new char[4096];
The compiler (2.062) complained that it cannot evaluate new char[] at
compile time.
I Then tried to move the declaration before function, the same thing
happened. Allocating statically sized array bloats the executable.
My idea is to return only a slice of array if less than 4K data was read
and prevent new allocation on every read.
So what I am doing wrong or is this not possible?
Thank.
More information about the Digitalmars-d-learn
mailing list