clang vs. gcc

DrMickeyLauer
Posts: 209
Joined: Sun May 22, 2022 2:42 pm

clang vs. gcc

Postby DrMickeyLauer » Sun Aug 10, 2025 2:51 pm

I have just noticed that Espressif provides support for clang since some time.
What are your experiences with this? Does one lead to better code over another?

MicroController
Posts: 2661
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: clang vs. gcc

Postby MicroController » Sun Aug 10, 2025 5:46 pm

Tried it a few times, never got clang to work on Windows, gave up.
My general impression is that clang may optimize some constructs a little better than gcc, saving one instruction here or there, but I think you'd be hard-pressed to find a case where it makes a measurable difference.
(If 1 or 2 instructions more or less in a section of code do make a significant difference in a certain case, I'd argue that that code shouldn't be left to chance by hoping for the compiler to choose the 'right' optimization every time.)

Sprite
Espressif staff
Espressif staff
Posts: 10593
Joined: Thu Nov 26, 2015 4:08 am

Re: clang vs. gcc

Postby Sprite » Mon Aug 11, 2025 12:26 am

FWIW, I think clang (or llvm) support in general is mostly done to get Rust to work. As far as I understand, gcc does not support Rust (yet).

DrMickeyLauer
Posts: 209
Joined: Sun May 22, 2022 2:42 pm

Re: clang vs. gcc

Postby DrMickeyLauer » Mon Aug 11, 2025 5:50 am

I see, thanks. I'll stick with gcc then.

Who is online

Users browsing this forum: dmaxben, Semrush [Bot] and 10 guests