Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Jonathan Lamothe Newsgroups: comp.lang.c,alt.lang.asm Subject: Re: A thought of C Date: Wed, 15 Apr 2026 10:51:00 -0400 Organization: A noiseless patient Spider Lines: 37 Message-ID: <87ldeoz38r.fsf@posteo.de> References: <3a3462bdd72c4ed9d392a78b7d369a7b5ccc3b04.camel@gmail.com> <10ro4gm$vh0m$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Injection-Date: Wed, 15 Apr 2026 14:51:13 +0000 (UTC) Injection-Info: dont-email.me; posting-host="461879344bef4bc63038c84fed2198bc"; logging-data="1014471"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18RN4V5Qnx+naF9+iHQcJw7KLtBD5NGOX8=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cancel-Lock: sha1:A884tDUctmYULUrkZxGhRoL+2W4= sha1:VCo9r36WwQ12L+qzZBKO9YRn+w4= Xref: csiph.com comp.lang.c:397550 alt.lang.asm:8820 makendo writes: >> The 4th difference: Local variable. >> (Assembly can theoritically do the same but I don't have impression which one >> support this feature.) > > If you are talking about function-local data, there are multiple ways > to do store them in an easy-to-clean-up fashion: > > - Volatile registers, for the shortest lived data. Calling other > functions causes them to be overwritten with the function's > return value or irrelevant data. > - Non-volatile registers, for data that need to persist across > function calls. You save the contents of them before using them, > as your caller expects the contents of these registers to be > intact once you return. > - The stack, for long-lived function-local data when you are out of > non-volatile registers. You manipulate a dedicated stack pointer > register to allocate and deallocate space for your data. > - Immediates, and the .rodata (ELF) / .rdata (PE) section, for > constants and tables of constants. > > The notion of local variable allows you to ignore all of these in C, > though. Assembly having multiple ways to store local data instead of > one can make things fairly complicated to read, write and debug. > > (forwarding to alt.lang.asm because you are comparing C with it) > So what you're saying is that assembly can do anything that any other arbitrary language (that has to eventually compile down to the same machine code) can do? This should not be surprising to anyone. -- Regards, Jonathan Lamothe https://jlamothe.net