Compile time format string check
Ada
notemail at not.com
Mon Mar 23 07:13:35 UTC 2026
On Monday, 23 March 2026 at 05:46:15 UTC, Richard (Rikki) Andrew
Cattermole wrote:
> On 23/03/2026 6:36 PM, Ada wrote:
>> On Monday, 23 March 2026 at 05:33:05 UTC, Richard (Rikki)
>> Andrew Cattermole wrote:
>>> On 23/03/2026 6:29 PM, Ada wrote:
>>>> On Sunday, 22 March 2026 at 22:49:24 UTC, Richard (Rikki)
>>>> Andrew Cattermole wrote:
>>>>> [...]
>>>>
>>>> I clearly said compile-time. maybe you misspoke.
>>>> It's a bit of a nuisance because the function call then
>>>> doesn't resemble C that much anymore. (it's called betterc)
>>>
>>> The only way to do it at CT, is either with the pragma with a
>>> string literal for the format, or the format must be provided
>>> via a template parameter.
>>>
>>> You cannot do this, with a function parameter at CT.
>>
>> In that case, how would you do it with the pragma or the
>> template parameter?
>
> Start with the pragma, I linked the docs for it.
>
> Parsing out the format spec by itself isn't a fun job and is
> libc dependent.
Hmm, just to be clear. The pragma just says that the function
marked with it will follow the C99 Standard 7.19.6.1.
Does that standard specify that custom format specifiers can be
defined by any chance?
Because that's essentially what I am trying to achieve.
More information about the Digitalmars-d-learn
mailing list