How to use core.vararg to print D variadic arguments and their types without using ! (template instantiation)?

2023-09-14 Thread BoQsc via Digitalmars-d-learn
https://dlang.org/phobos/core_vararg.html The common way to use **va_arg** is `va_arg!(int)(_argptr);` What would be the alternative way or syntax that behave exactly the same way, even if more verbose? `va_arg!(int)(_argptr);` is taken from an example in: https://dlang.org/spec/functio

Re: Help on array pointers

2023-09-14 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 14 September 2023 at 14:21:09 UTC, Vino wrote: Questions:1 ``` char[] invalid = (cast(char*)malloc(char.sizeof * length))[0..length]; ``` The above statement allocate memory for char type and the size of the allocated memory is char.sizeof * length so what is the use of this "[0.

Re: Help on array pointers

2023-09-14 Thread Vino via Digitalmars-d-learn
On Thursday, 14 September 2023 at 15:33:45 UTC, Paul Backus wrote: On Thursday, 14 September 2023 at 14:21:09 UTC, Vino wrote: Questions:1 ``` char[] invalid = (cast(char*)malloc(char.sizeof * length))[0..length]; ``` The above statement allocate memory for char type and the size of the alloc

Re: Help on array pointers

2023-09-14 Thread vino via Digitalmars-d-learn
On Thursday, 14 September 2023 at 17:23:53 UTC, Vino wrote: On Thursday, 14 September 2023 at 15:33:45 UTC, Paul Backus wrote: On Thursday, 14 September 2023 at 14:21:09 UTC, Vino wrote: Questions:1 ``` char[] invalid = (cast(char*)malloc(char.sizeof * length))[0..length]; ``` The above state

Re: Help on array pointers

2023-09-14 Thread Joe--- via Digitalmars-d-learn
On Thursday, 14 September 2023 at 14:21:09 UTC, Vino wrote: Hi All, Request your help to guide me in understanding about pointers, the below code works,I have few question which i need your help for better understanding. Questions:1 ``` char[] invalid = (cast(char*)malloc(char.sizeof * l