C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Type-safe printf and auto

From: Robin Rowe <robin.rowe_at_[hidden]>
Date: Sun, 12 Mar 2023 19:02:04 -0700
> No, that's not silencing a warning. That's fixing the bug. That's one
> of the few places where a cast is the right thing.

Interesting idea, Alex. However, I don't think so. Doing a cast is
always taking a chance of unexpected results. I typically fix printf
warnings by changing the format to use the right flag.

Just a thought, if casting to (intmax_t) is always the right thing, then
printf would only need one integer format flag... ;-)

Appreciate the feedback.

Robin

Received on 2023-03-13 02:02:07