You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And then crash("oops"); on line 42 of main.c will print "main.c(42): oops", not "utilities.h(6): oops".
On the other hand, rgbasm does not work like that. __FILE__ and __LINE__ use their deepest context in the fstack of include, rept, and macro nodes. So they're only useful for local reporting, but then, you already know what line you're on when you write them.
If anything, it would be more useful to expose other dynamic information. Such as the current section name, which #1066 would allow with SECTION(@). Or the current "label scope", a concept which is mentioned in rgbasm(5) but not currently accessible. (Similar to __func__ in C99, or __FUNCTION__ in gcc prior to that.) That would let you do this in utilities.inc:
Unlike C, these constants are not convenient for logging in macros,
since they always report the same data (their location in the macro).
Fixesgbdev#1068
Unlike C, these constants are not convenient for logging in macros,
since they always report the same data (their location in the macro).
Fixesgbdev#1068
Rangi42
added a commit
to Rangi42/rgbds
that referenced
this issue
Sep 30, 2022
Unlike C, these constants are not convenient for logging in macros,
since they always report the same data (their location in the macro).
Fixesgbdev#1068
The advantage of these constants in C is that they're not affected by macros, so you can have a "utilities.h":
And then
crash("oops");
on line 42 of main.c will print "main.c(42): oops
", not "utilities.h(6): oops
".On the other hand, rgbasm does not work like that.
__FILE__
and__LINE__
use their deepest context in the fstack of include, rept, and macro nodes. So they're only useful for local reporting, but then, you already know what line you're on when you write them.If anything, it would be more useful to expose other dynamic information. Such as the current section name, which #1066 would allow with
SECTION(@)
. Or the current "label scope", a concept which is mentioned in rgbasm(5) but not currently accessible. (Similar to__func__
in C99, or__FUNCTION__
in gcc prior to that.) That would let you do this in utilities.inc:The text was updated successfully, but these errors were encountered: