On Thu, 6 Mar 2008 18:22:38 +0100 (CET), CJ <> wrote in
comp.lang.c:
> Some compilers support __asm{ } statement which allows integration of C
> and raw assembly code. A while back I asked a question about such
> syntax and was told that __asm is not a part of a C standard. My
> question now is:
>
> Is there a chance that such statement will become a part of C standard
> in the future? In some cases using asm language is the best way to
> acomplish some small task, hence integration of C and asm would greatly
> enhence C, or atleast it would in my opinion.
Once upon a time, before the first ANSI standard in 1989, some
implementations of C supported an "asm" keyword. The original C
standard committee decided not to standardize that as part of the
language. Google the C Rationale to read their reasons.
Interestingly enough, a certain vendor that repeatedly behaves in a
way that could be interpreted as an attempt at user lock-in, added
assembly language inclusion to its compiler, with a completely
different syntax than that of the C compilers I was familiar with.
Later on, the C++ standard did include the "asm" keyword, with exactly
the same syntax that was common among early C compilers. So now this
certain vendor had __asm which is non-standard in both C and C++.
> Is there a good reason why __asm is not a part of current C standard?
Yes.
> I have bumped into compilers that support and others that ignore __asm
> statement so obviously it is still not a part of C standard.
You can bump into all sorts of non-standard extensions in compilers
without even trying very hard.
> Putting it in the C standard would let programmers include assembly for
> optimization while maintaining maximal portability.
You have no concept of what you are talking about. There is no
portability in assembly language. Not even for the same processor
under the same operating system.
How portable do you think asm("MOV EAX,EBX") is going to be in a C
compiler for an ARM, of which there is one in just about every cell
phone made?
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://c-faq.com/
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html