Code Bloat Hurts Readability

A small snippet we dug up while analyzing vibe-coded projects. Looking at vibe-coded projects through the lens of static analysis and our own expertise, one thing stands out: the code is too bloated and hurts readability. A developer would have simply used 'sprintf', but unfortunately, there's another case... What do you think about code like this? #vibecoding #development #coding #programming

  • No alternative text description for this image

This code will execute much much faster than a sprintf.

Jean-Yves Astier How about the following code: int const time_ms = 15 + (i * 7) % 30; char seq[32] = ": icmp_seq-0 tt1=64 time-00 ms\n"; seq[11] = (char)('0' + i); seq[25] = (char)('0' + (time_ms / 10)); seq[26] = (char)('0' + (time_ms % 10)); It should be faster and smaller than the generated code and much faster than sprintf().

That's such a great discussion, thank you! Maybe you'd like to look at other cases a little bit closer, we wrote about them too in the previous article about vibe coding. Would be great to hear your thoughts about it as well. https://pvs-studio.com/en/blog/posts/cpp/1354/

Like
Reply

if thats vibe coded, then the problem is not AI, its the pilot I am afraid

See more comments

To view or add a comment, sign in

Explore content categories