assembly in future C standard HCF Gerry Wheeler


    Sponsored Links


  • 1. n00b input help
    Hi, I'm writing a program that performs arithmetic operations on integers. I want to be able to type in a bunch of integers seperated by any amount of white space then terminate input with a non-integer character. I plan to put my input into an array, and while I have a max size I don't have a min and don't know exactly how many arguments to expect. I would really appreciate any ideas. Cheers.
  • 2. Some doubts on variable-length array
    Hello experts, I have seen following the code snippet given by Marc Boyer (with slight changes by me for a better format), and have doubts on it. I am so grateful if you can give me your kindly help and hints on this problem. 1. Does the function call `foo(3, 3, tab);' refer to the data outside the array `int tab[9];'. The available subscription for a 3X3 2-D array should be 0..2 X 0..2, I think. 2. For the available function call `foo(2, 2, tab);' (I do not think the second one is unavailable, just not sure.), which element in the array `int tab[9];' does tab[0][0] refer to inside the body of the function `foo'. I want to know the exact one int the format `tab[0] .. tab [8]'. And which element in `int tab[9];' does tab[1][1] refer to. I can not figure it out for some while on it. The GCC4.1 says it does not support the variable-length array of C99, but I can compile this program on even GCC3.3.5, and also on GCC4.1 after I installed this newest one. I also get the same result of the program as Marc Boyer. Sincerely, lovecreatesbeauty /* sample by Marc Boyer */ #include <stdio.h> void foo(int size_x, int size_y, int tab[size_x][size_y]) { printf("tab[1][1] == %d\n", tab[1][1]); } int main() { int tab[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; foo(2, 2, tab); foo(3, 3, tab); return 0; } news> ./a.out tab[1][1] == 3 tab[1][1] == 4

Re: assembly in future C standard HCF Gerry Wheeler

Postby Walter Banks » Sat, 04 Nov 2006 22:35:39 GMT

As this thread wanders off topic this industry was introduced to a new
mnemonic in Byte article about decoding the undocumented
Motorola 6800 instructions. The HCF (Halt Catch Fire) opcode $DD
or $D9. HFC locked up the processor and cycled the address bus
The author of that article was Gerry Wheeler.

Gerry Wheeler, 54, died October 15, 2006, advanced non-Hodgkins
lymphoma cancer. Gerry made significant contributions to the technology
of the embedded systems world and was a key part of the development
of many household name products.

Programmer, Ham KG4NBB, author, father, husband, active commuity
participant Gerry will be missed by all.


Similar Threads:

1.assembly in future C standard

Peter Nilsson < XXXX@XXXXX.COM > wrote:

(Crossposted to comp.std.c, with followups directed there, hopefully
 appropriately.  The original post discussed the possibility of whether
 __asm or something similar to it would be added to the C standard.)

> Contrary to Richard Heathfield's categorical statement, it is not an
> absolute given that there will never be an asm keyword in C. But it
> is unlikely because it's already clear that the asm keyword in C++ has
> not served to truly standardise the syntax of inline assembly.

One idea that was not mentioned in the original thread (I imagine for
good reason, because it's a half-baked and probably stupid idea that
occurred to me reading your post) would be to allow for some kind of
conditional assembly, just perhaps something like

#pragma assemble
#pragma X86 /* Inner pragma's implementation-defined */
  /* Inline assembly, which the implementation can ignore or not */
#pragma no-assemble
  /* Stock C code for implementations that can't or won't accept the
   * assemble pragma: */
  for( i=1; i < 10; i++ ) {
    /* ... */
#pragma end-assemble

The end result would be something like "If the implementation attempts
to inline the assembly code contained within a #pragma assemble
directive, the behavior is implementation-defined.  Otherwise the
assembly code shall be ignored and the C code contained within any
corresponding #pragma no-assemble directive shall be compiled as
though no directives were present."  It would require adding some
duties to the #pragma directive, but it would allow implementors to
take a reasonable shot at using targetted assembly instructions when
appropriate and available, and reverting to ordinary C otherwise.

I'm sure there are reasons why this is stupid and/or impossible, or it
would have been done already :-)

> At the end of the day, the committee could probably spend many man
> weeks deciding issues on an __asm keyword, but for what? Most
> implementations will keep their existing syntax, and most programmers
> who use inline assembly will no doubt continue to prefer the localised
> syntax because it's less cumbersome than any standard syntax.

Indeed, but it's an interesting thought experiment to consider how the
committee *might* add assembly to C if they chose to do so.  (Well,
interesting to me, at least.)

C. Benson Manica           | I *should* know what I'm talking about - if I
cbmanica(at)      | don't, I need to know.  Flames welcome.

Return to c


Who is online

Users browsing this forum: No registered users and 19 guest