News for hackers. Stuff that matters.
Re:New C features in GCC 13 by unwind on Thursday May 04, 2023 @09:18AM (#35814804)
There is nothing "dynamic" about what I suggested. There is a real, concrete, static and compile-time known type at all times.

In this case it would be long. I fail to see the huge risk you're implying by operating upon a long-typed value without repeating the type name in the code.

    const auto pos_auto = ftell(fp);
    const long pos_long = ftell(fp);
I don't understand what you can do with 'pos_long' that would be dangerous doing with 'pos_auto' (again, disregarding I/O since then you typically have to know or cast).
Re:New C features in GCC 13 by shrimp_emoji on Thursday May 04, 2023 @08:03PM (#35823756)
> again, disregarding I/O since then you typically have to know or cast

Thank you for answering for me!

Re:New C features in GCC 13 by astrange on Thursday May 04, 2023 @09:54PM (#35824427)
`const long pos_long = ftell(fp);` contains a potential implicit case in the future if the return type of `ftell()` changes.

That's one reason type inference is safer than not inferring. Your program doesn't include semantics you didn't actually intend to be part of its meaning.

Also, I think lambdas would be annoying without it.