Getting __COLUMN__ of source code location.

realhet real_het at hotmail.com
Sun Jul 23 15:01:51 UTC 2023


Hi,

I can access the special tokens: __MODULE__, __LINE__, but how 
can I access the column.

Is there a way to "hack" it out from LDC2?

All the error messages contain column information, also I've 
found __traits(getLocation, symbol) also reporting the column.

But how to get this information for the caller's location?

(
Why is this important?
- I have an immediate GUI which is using this __MODULE__LINE__ 
data to generate a unique ID. And I must put every GUI control 
creation command on a different line or provide a unique ID 
manually.
- Now I'm planning an automated data logging debugging thing and 
it will sample expressions. The one expression per source code 
line is also problematic. I can give each PROBE an unique ID by 
using a preprocessor, but that's not a nice solution, that would 
be an overcomplication I try to avoid.

Example:
PROBE!0(somefunction(PROBE!1(expr1), PROBE!2(expr2)));
Here are 3 PROBES on the same line, but the PROBE template is 
unable to distinguish them without the __COLUMN__.
)

Thank You for your time.


More information about the Digitalmars-d-learn mailing list