Re: compiled code & ShowMessage
- From: Rob Kennedy <me3@xxxxxxxxxxx>
- Date: Sat, 27 May 2006 02:55:45 -0500
claude.animo@xxxxxxxxx wrote:
Rob,
thank you for answering my question.
The compiler only works with what it's given, and if you give it a call to a VCL function, then that's what it will generate.
Any compiler is designed in order to optimize the processed code
(size/speed), without altering the semantic/behaviour of the program.
A compiler that recognizes the semantics of a program is a *very* sophisticated compiler. I'm not aware of any such compilers in existence.
When I use ShowMessage, I don't ask for a specific machine code
implementation.
Yes you do. You ask for the specific function ShowMessage, which refers to the function declared and implemented in the Dialogs unit. Since that's the only implementation of ShowMessage available, you have necessarily asked for that.
I just ask for a behaviour.
You asked for the behavior of a program that calls the Dialogs.ShowMessage function. Why would the compiler give you anything other than what you asked for?
Any compiler must be clever enough, to produce the "best"
implementation.
Wrong. It needs to produce a *correct* implementation. How would compiler determine what "best" means? How can it recognize the "best" implementation? How can you or I recognize it?
Actually, compilers don't produce implementations. To have it produce an implementation suggests that the compiler has some leeway -- some creativity in accomplishing what it has been asked to do. But it doesn't. You've provided the source code, and the compiler's job is to turn it into the corresponding machine instructions.
It's your job, as the programmer, to provide an implementation based on the specifications you have. You get to choose how to implement the specifications.
Calling an API is not always a user choice.
Then whose choice is it?
In my case
I don't claim for anything but displaying a message.
And that's exactly what you got.
From a compiler point of view, in this specific case, the targetted OS
only matters.
From the compiler's point of view, it has encountered a command from the programmer to call the Dialogs.ShowMessage function. If it called something else instead, then that would be an error.
That's why I'm so surprised by the overwhelming amount of generated
code.
Claude
--
Rob
.
- References:
- compiled code & ShowMessage
- From: claude . animo
- Re: compiled code & ShowMessage
- From: Rob Kennedy
- Re: compiled code & ShowMessage
- From: claude . animo
- compiled code & ShowMessage
- Prev by Date: Re: compiled code & ShowMessage
- Next by Date: Re: Free StringGrid with nested header columns and footer
- Previous by thread: Re: compiled code & ShowMessage
- Next by thread: Re: compiled code & ShowMessage
- Index(es):
Relevant Pages
|
|