Re: Tracing/Profiling D Applications

2022-05-25 Thread frame via Digitalmars-d-learn
On Wednesday, 25 May 2022 at 21:35:07 UTC, Christian Köstlin wrote: Is there also a way to get the "real" threadid? I'm using that functions inside threads: core.sys.windows.winbase.GetCurrentThreadId on Windows core.sys.posix.pthread.pthread_self on Unix (implied pthreads are used)

Re: Tracing/Profiling D Applications

2022-05-25 Thread Ali Çehreli via Digitalmars-d-learn
On 5/25/22 14:35, Christian Köstlin wrote: > 1. I went for a singleton for storing tracing/logging information that > needs to be initialized manually. Is __gshared the right way to do that? I think this is where thread-local storage comes in handy. As the D runtime does for dmd's -profile

Tracing/Profiling D Applications

2022-05-25 Thread Christian Köstlin via Digitalmars-d-learn
I experimented with application level tracing/profiling of d applications similar to what is described in https://dlang.org/blog/2020/03/13/tracing-d-applications/ as the "writef-based approach". Only difference is, that I am emitting json

Re: Cannot check function address

2022-05-25 Thread frame via Digitalmars-d-learn
On Wednesday, 25 May 2022 at 14:09:31 UTC, Steven Schveighoffer wrote: Yes, he acknowledged that too much was stripped. I also verified similar code works. But the real problem was something else. He is saying in this message "why doesn't the compiler recognize that in comparing a function

Re: Cannot check function address

2022-05-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/25/22 6:55 AM, user1234 wrote: On Wednesday, 25 May 2022 at 06:04:10 UTC, frame wrote: On Wednesday, 25 May 2022 at 05:56:28 UTC, Steven Schveighoffer wrote: It's a case where the compiler can't divine what you were thinking when you wrote that code ;) I see not in all cases but in

Re: Why (v1<<8 + v2) different from (v1<<8 | v2)?

2022-05-25 Thread step8 via Digitalmars-d-learn
Thanks:) **writeln( (v1<<8) + v2 );** is ok On Wednesday, 25 May 2022 at 12:51:07 UTC, Paul Backus wrote: On Wednesday, 25 May 2022 at 12:42:04 UTC, step8 wrote: I run following test code: int v1 = 22; int v2 = 23; writeln( v1<<8 + v2 );

Re: Why (v1<<8 + v2) different from (v1<<8 | v2)?

2022-05-25 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 25 May 2022 at 12:42:04 UTC, step8 wrote: I run following test code: int v1 = 22; int v2 = 23; writeln( v1<<8 + v2 ); writeln( v1<<8 | v2 ); result is 0 and 5655 Why ( v1<<8 + v2 ) = 0 ? `+` has a higher precedence than `<<`, so the

Why (v1<<8 + v2) different from (v1<<8 | v2)?

2022-05-25 Thread step8 via Digitalmars-d-learn
I run following test code: int v1 = 22; int v2 = 23; writeln( v1<<8 + v2 ); writeln( v1<<8 | v2 ); result is 0 and 5655 Why ( v1<<8 + v2 ) = 0 ?

Re: Cannot check function address

2022-05-25 Thread user1234 via Digitalmars-d-learn
On Wednesday, 25 May 2022 at 06:04:10 UTC, frame wrote: On Wednesday, 25 May 2022 at 05:56:28 UTC, Steven Schveighoffer wrote: It's a case where the compiler can't divine what you were thinking when you wrote that code ;) I see not in all cases but in mine. If the compiler sees the

Re: Cannot check function address

2022-05-25 Thread frame via Digitalmars-d-learn
On Wednesday, 25 May 2022 at 05:56:28 UTC, Steven Schveighoffer wrote: It's a case where the compiler can't divine what you were thinking when you wrote that code ;) I see not in all cases but in mine. If the compiler sees the function isn't callable without arguments and it is inside an

Re: Cannot check function address

2022-05-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/25/22 1:40 AM, frame wrote: This would have been more visible if the compiler just says: "function cannot be compared against null, only function pointer". That function vs function pointer is too subtle. It's a case where the compiler can't divine what you were thinking when you