[m-users.] string_writer / stream and writing strings with %s in them
Sean Charles (emacstheviking)
objitsu at gmail.com
Mon Feb 14 00:22:47 AEDT 2022
I deliberately put back my broken code, added --warn-unknown-format-calls to the Makefile and rebuilt and guess what, not only did it highlight those lines but also some other code in an ANSI colour output module I created, these were the ones I was expecting:
Making Mercury/cs/tutils.c
tutils.m:324: Unknown format string in call to `string.format'/3.
tutils.m:324: Unknown format values in call to `string.format'/3.
tutils.m:644: Unknown format string in call to `string.format'/3.
tutils.m:644: Unknown format values in call to `string.format'/3.
tutils.m:807: Unknown format string in call to `stream.string_writer.format'/5.
and the bonus finds of:
Making Mercury/cs/target_c.c
target_c.m:1013: Unknown format string in call to `string.format'/3.
and:
Making Mercury/cs/aio.c
aio.m:042: Unknown format string in call to `io.format'/4.
aio.m:042: Unknown format values in call to `io.format'/4.
aio.m:044: Unknown format string in call to `io.format'/4.
aio.m:044: Unknown format values in call to `io.format'/4.
aio.m:048: Unknown format string in call to `io.format'/4.
aio.m:048: Unknown format values in call to `io.format'/4.
aio.m:051: Unknown format string in call to `string.format'/3.
aio.m:051: Unknown format values in call to `string.format'/3.
Excellent! I can fix these now and I didn't even know...I've seen a list of compiler options in chapter 9 of the user guide PDF but probably forgotten as there are so many and again, as a beginner, yo don't know what you need.
Perhaps there could be an over-arching '--enable-n00b-mode' flag which enables that option and anything else that might be helpful to beginning Mercury users?
For me, I'd say turn it on by default because, as a beginner, sometimes any clue from the compiler can help enlighten you when faced with an issue.
Thanks,
Sean.
> On 13 Feb 2022, at 09:57, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
>
>>
>> stream.string_writer.format(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20220213/c9c5af12/attachment.html>
More information about the users
mailing list