TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: RICHARD KETTLEWELL
from: THE NATURAL PHILOSOPHER
date: 2018-04-23 11:56:00
subject: Re: Apologies where they

On 23/04/18 10:59, Richard Kettlewell wrote:
> The Natural Philosopher  writes:
>
>> On 23/04/18 09:55, jack4747@gmail.com wrote:
>>> Il giorno lunedì 23 aprile 2018 10:16:01 UTC+2, Gordon Henderson ha
scritto:
>>>
>>>> I have looked at compiling my BASIC to native code - and there is more
>>>> or less a 1:1 relationship with a line of BASIC and a Line/Block of ASM
>>>> - it's no-where near efficient as C though (and 'compiling' BASIC into
>>>> C is just as easy and may actually result in faster code, but that's a
>>>> job for another day)
>>>
>>> It's not that C is inherently efficient, it's the compiler that
>>> optimize the asm.
>>> If you compile a C source code with optimization disabled, you'll
>>> get a (almost) 1:1 relationship line of C : line of asm.
>>
>> I think that is only half of it: The other half is that C IS
>> assembler, written in shorthand. I cannot offhand think of any native
>> c operation that is not an atomic assembler operation.
>>
>> Ok sometimes on some processors operation on the contents of memory
>> are two opcodes.
>
> ! compiles to two instructions on ARM

really!

> and three on x86, in

surely if in a conditional statment its just a reversal of the
condition..I suppose you mean assignment like "a=!a" ...



> isolation. Signed division is a subroutine call on ARM and two
> instructions on x86.

I didnt realise ARM has no div instruction


> Initialization and assignment of large objects may
> involve many instructions or a subroutine call.
>

Thats the same in any language tho. Initialisation of large static
objects  is not done at run time in any compiled language is it?

And I cant see how you can initialise something like a dynamic array of
structures in any other way than explicitly via a loop, or explicit
statements..



> The prevalence of undefined behavior in C also punches a rather large
> hole in any assumption of a direct mapping into assembler.
>
Again that doesn't make sense. You can still map to assembler direct:
the questions is WHAT assembler you map to...and what it does.

I.e. deferencing a null pointer maps straight to assembler allright, but
what happens is what is undefined - seg fault, random number or whatever
happens to be a memory location zero..







--
If I had all the money I've spent on drink...
..I'd spend it on drink.

Sir Henry (at Rawlinson's End)

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.