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!
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
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){
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
:)
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
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.
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,
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;
}