K
Kaz Kylheku
Then they're not C compilers (though they may be perfectly useful
compilers for some C-like dialect).
A C-like dialect is C; it's just not ISO C.
Then they're not C compilers (though they may be perfectly useful
compilers for some C-like dialect).
(snip)
More specifically, many Fortran 66 and 77 compilers allocated
all variables statically. Some used static storage for the
return address.
A C-like dialect is C; it's just not ISO C.
A duck that says "who's a pretty boy then?" instead of quacking is still a duck.Not in *this* newsgroup, buddy!
On the compilers I have seen of this sort, they don't normally use
stacks and recursion is avoided when possible - but is not disallowed
completely. Stacks on chips like the 8051 are extremely inefficient for
data, so the compiler usually aims to use fixed memory addresses for
parameter passing and local data (the hardware stack is fine for return
addresses).
On some such compilers, you need special pragmas or extra
keywords to allow a function to be recursive or re-entrant - then it is
not standard C since you need extra compiler-specific lines to get
standard re-entrant behaviour. On other compilers, the compiler can
figure out if a function is used recursively (or re-entrantly from
interrupts) and generate the software stack code only when strictly
needed. My guess is that such compilers are then standard C on that
particular point.
Typically such compilers stray from standard C on other issues, such as
lack of double-precision floating point (sometimes lack of
single-precision floats too), and perhaps lack of 32-bit integer types,
etc. They are, as you say, a C-like dialect.
(snip, someone wrote)
If you declare all data static, it won't need to go on the stack.
If you pass arguments in file scope or external variables, instead of
function arguments, they won't go on a stack.
I think I remember some processors with a four entry return
address stack.
Also, the standard allows for differences in non-hosted systems.
They might have a name with a C in it, but still not claim to be
C compilers.
I've seen languages that differentiate procedures and functions,
but I've always thought that subroutines are a general term referring
to reusable program units, including procedures and functions and
even any portion of a BASIC program, without a clear block structure,
that can be called by GOSUB <line number>.
[...]David Thompson said:algol 60 had PROC with or without return (value) type; algol 68 the
same keyword but described them as 'routine', and used explicit 'void'
for no value. PL/I had PROCEDURE or abbreviated PROC with or without
RETURNS(type). C did not use any keyword, but called them 'function'
and allowed value type (defaulting to int until C99) or void.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.