Re: mixing C and assembly



cbarn24050@xxxxxxx wrote:
On Apr 23, 7:27�pm, Walter Banks <wal...@xxxxxxxxxxxxx> wrote:
Stefan Reuther wrote:
register_sp SP;
SP = int_value;
What you're doing here is writing assembly with C syntax. It relies upon
a heavily non-standard language extension, and makes assumptions about
how the compiler behaves (you don't want the compiler to use the stack
before your SP assignment, do you?). So instead of writing assembly in
C, I prefer using the real thing.

Yes, thats what he always does! He can then claim his compiler can
beat assembler for speed,code size ect. To Walter if it looks Cish,
ends in a semicolon and his compiler can change it into machine code
then its C.


I actually agree with you it is very low level C. The purpose of ISO/IEC
18037 was to define the low level syntax. Most start up code is very processor
family specific. �Writting start up code in C makes good use of C's
optimization like the branch/jump to main.

Whats to optimise? Why bother optimising a one time instruction?

Sometimes I think you'll say anything to sell a compiler.


Why would you bother optimising a traditional call to main into a jump? On some targets (in particular, several that Bytecraft target), the saved stack space is significant - and even the couple of saved flash bytes is worth doing (given the negligible cost of the compiler's effort).

There is also the question of why would one bother to write code that you know is less than optimal, if it is just as easy to write better code?
.



Relevant Pages

  • Re: Tcl Switch case
    ... My thesis is that there could be a good reason to change the syntax of ... a command, and one reason is to align with what the byte compiler ... bug has persisted for 15 years, but has never kept anyone from writing ...
    (comp.lang.tcl)
  • Re: Handling error/status messages by interface to C++ programs
    ... about how to design a compiler, please tell me where I can find ... exceptions for managing the error detection is rather a bad idea. ... I have to say I have seen a simple example of an object-oriented parser design in some book (unfortunately I forgot ... It would trigger user notification and do recover housekeeping like reseting the current syntax row's token stack because one wants to continue parsing and detect any other errors w/o aborting. ...
    (comp.object)
  • Re: Syntax (was: Perfrom Thru
    ... "This statement has violated the limits of this compiler" ... these are syntax violations in the Standard's definition of them. ... > whether the problem is a compiler limitation or it is a syntax error, ... >> Then not "source violates the SYNTAX rules of the Standard" ...
    (comp.lang.cobol)
  • Re: Compiler quality
    ... compilers should be able to be 100% tested for syntax bugs by limiting ... be detected outside of the syntax portion of the compiler. ... language rules provide enough testing for the syntax proper. ... selection of a component using the "current instance" of a protected ...
    (comp.lang.ada)
  • Re: RAD vs. performance
    ... It depends on what the compiler can infer and optimize. ... rationals are another type, which are not supported in the cpu and would ... (rather than typed declarations based language with a class-based types ... using about the same syntax as before. ...
    (comp.lang.misc)