Re: writef, compile-checked format, pointer

2021-08-10 Thread Ali Çehreli via Digitalmars-d-learn
On 8/9/21 10:03 PM, nov wrote: > i dreamed that programming will be less-error with compile checking format. I still think so because many errors that can be caught at compile time are moved to run time in non-statically-typed languages. > but reality disappoint :( > message for every error

Re: writef, compile-checked format, pointer

2021-08-10 Thread Tejas via Digitalmars-d-learn
On Tuesday, 10 August 2021 at 05:03:12 UTC, nov wrote: every time i try to use templates, i have problems :( That is why C++ introduced concepts. Wonder when D will be getting them :(

Re: writef, compile-checked format, pointer

2021-08-09 Thread nov via Digitalmars-d-learn
On Monday, 9 August 2021 at 22:30:43 UTC, Ali Çehreli wrote: Error: expression `FormatException("Expected one of %s, %x or %X for pointer type.", i saw this message too, and this is one of reasons of my original question. '%s' bad for pointer in my cases, because result often contains somet

Re: writef, compile-checked format, pointer

2021-08-09 Thread Ali Çehreli via Digitalmars-d-learn
On 8/9/21 3:46 PM, Adam D Ruppe wrote: > The compile time checker [...] implementation is really really > slow and pretty bloated in codegen too. > > My personal policy is to never use it. My personal policy is to kindly ask you to fix it! :p Ali

Re: writef, compile-checked format, pointer

2021-08-09 Thread Adam D Ruppe via Digitalmars-d-learn
On Monday, 9 August 2021 at 22:30:43 UTC, Ali Çehreli wrote: I don't know the reason but I suspect a bug in the compile-time checker that involves .init values for arguments. The compile time checker is pretty bad tbh, it just tries to ctfe execute the given string and sees if it throws. That'

Re: writef, compile-checked format, pointer

2021-08-09 Thread Ali Çehreli via Digitalmars-d-learn
On 8/9/21 3:01 PM, Patrick Schluter wrote: > On Monday, 9 August 2021 at 19:38:28 UTC, novice2 wrote: >> format!"fmt"() and writef!"fmt"() templates >> with compile-time checked format string >> not accept %X for pointers, >> >> but format() and writef() accept it >> >> https://run.dlang.io/is/aQ

Re: writef, compile-checked format, pointer

2021-08-09 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 9 August 2021 at 22:01:18 UTC, Patrick Schluter wrote: On Monday, 9 August 2021 at 19:38:28 UTC, novice2 wrote: format!"fmt"() and writef!"fmt"() templates with compile-time checked format string not accept %X for pointers, but format() and writef() accept it https://run.dlang.io/is

Re: writef, compile-checked format, pointer

2021-08-09 Thread Patrick Schluter via Digitalmars-d-learn
On Monday, 9 August 2021 at 19:38:28 UTC, novice2 wrote: format!"fmt"() and writef!"fmt"() templates with compile-time checked format string not accept %X for pointers, but format() and writef() accept it https://run.dlang.io/is/aQ05Ux ``` void main() { import std.stdio: writefln; int x

writef, compile-checked format, pointer

2021-08-09 Thread novice2 via Digitalmars-d-learn
format!"fmt"() and writef!"fmt"() templates with compile-time checked format string not accept %X for pointers, but format() and writef() accept it https://run.dlang.io/is/aQ05Ux ``` void main() { import std.stdio: writefln; int x; writefln("%X", &x); //ok writefln!"%s"(&x); //