Re: betterC error?

2018-06-12 Thread Walter Bright via Digitalmars-d
On 6/12/2018 7:31 PM, makedgreatagain wrote: Thanks for all you help, the betteC is really useful and handy. That's great to hear!

Re: betterC error?

2018-06-12 Thread makedgreatagain via Digitalmars-d
On Tuesday, 12 June 2018 at 18:41:57 UTC, Walter Bright wrote: On 6/12/2018 5:13 AM, makedgreatagain wrote: extern(C) int main(string[] args){ Need to declare main() like those C people do: extern (C) int main(int argc, char** argv){ Thanks for all you help, the betteC is really useful an

Re: betterC error?

2018-06-12 Thread Walter Bright via Digitalmars-d
On 6/12/2018 5:13 AM, makedgreatagain wrote: extern(C) int main(string[] args){ Need to declare main() like those C people do: extern (C) int main(int argc, char** argv){

Re: betterC error?

2018-06-12 Thread SrMordred via Digitalmars-d
Or use C malloc. We really should provide better tools to create arrays using C malloc (for those who want them). Like a betterC toolkit. -Steve Indeed, i´m creating my own "toolkit" for betterC stuff like alloc!Type(length); (much safer than malloc!) and other utilities :)

Re: betterC error?

2018-06-12 Thread Steven Schveighoffer via Digitalmars-d
On 6/12/18 10:18 AM, SrMordred wrote: On Tuesday, 12 June 2018 at 12:29:17 UTC, rikki cattermole wrote: (...) this line: byte[] data = [0, 1]; is an dynamic array allocated with GC. But if you declare as a static array like byte[2] data = [0, 1]; than its not GC allocated. Or use C mall

Re: betterC error?

2018-06-12 Thread SrMordred via Digitalmars-d
On Tuesday, 12 June 2018 at 12:29:17 UTC, rikki cattermole wrote: (...) this line: byte[] data = [0, 1]; is an dynamic array allocated with GC. But if you declare as a static array like byte[2] data = [0, 1]; than its not GC allocated.

Re: betterC error?

2018-06-12 Thread rikki cattermole via Digitalmars-d
On 13/06/2018 12:13 AM, makedgreatagain wrote: this very simple code can not build with betterC void test(byte[] x){ } extern(C) int main(string[] args){   byte[] data = [0, 1]; test(data); return 0; } Well yes, dynamic arrays require the GC and hence TypeInfo. Slices don't,

betterC error?

2018-06-12 Thread makedgreatagain via Digitalmars-d
this very simple code can not build with betterC void test(byte[] x){ } extern(C) int main(string[] args){ byte[] data = [0, 1]; test(data); return 0; }