startup-time icon indicating copy to clipboard operation
startup-time copied to clipboard

C code should use `puts`

Open jaredkrinke opened this issue 2 years ago • 2 comments

The current code uses printf which allows for formatted/dynamic output, but I would expect it to use puts for verbatim output.

jaredkrinke avatar Aug 29 '23 18:08 jaredkrinke

In this case it makes no difference. They should both compile to a single mov instruction.

necrophcodr avatar Jan 23 '25 23:01 necrophcodr

I think puts is more idiomatic for a constant string, but you're right that there's no difference in performance--gcc and clang are smart enough to replace the printf call with puts:

https://godbolt.org/z/s5qzbrMqe

jaredkrinke avatar Jan 24 '25 00:01 jaredkrinke