Programming in C - questions

You can talk about almost anything that you want to on this board.

Moderator: Moderators

User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: Programming in C - questions

Post by thefox »

koitsu wrote:You can use gcc -S -masm=intel to review the generated assembly (.s files) in Intel format. Rest of my advice about optimisation flags etc. from and earlier post still applies. Don't be surprised if what you find scares you.
Compiler Explorer is very handy for this kind of work.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Programming in C - questions

Post by Zepper »

thefox wrote:
koitsu wrote:You can use gcc -S -masm=intel to review the generated assembly (.s files) in Intel format. Rest of my advice about optimisation flags etc. from and earlier post still applies. Don't be surprised if what you find scares you.
Compiler Explorer is very handy for this kind of work.
One word - awesome.
I'm playing with it and... my CHR decoding function was 85 ASM lines. Now it's 67.
User avatar
pubby
Posts: 583
Joined: Thu Mar 31, 2016 11:15 am

Re: Programming in C - questions

Post by pubby »

godbolt is such a great tool.
However, if the performance of an initializer is critical for your application there is no general advice anyone can give for how to write it the "best" way.
I dunno. Initializer lists seem like a clear winner to me. They require no analysis to optimize; they produce better code than memset on -O0. And their syntax is... well... intended for initialization!
Anyway, does anyone know of any good recourses for learning C from Java?
If you understand 'if' 'for' 'while' and functions then start writing code. That's all you need to get started.
Post Reply