assembly in future C standard HCF Gerry Wheeler


    Sponsored Links


  • 1. "Private to subproject" functions and variables
    Hi all, maybe it's an old question, but I couldn't find an answer... let's say I have this kind of directory structure for project foo: /foo/includes/mod1.h (exported by mod1) /foo/includes/mod2.h (exported by mod2) /foo/mod1/file1.c /foo/mod1/file1.h (exported by file1) /foo/mod1/file2.c /foo/mod1/file2.h (exported by file2) /foo/mod2/file1.c /foo/mod2/file1.h (exported by file1) /foo/mod2/file2.c /foo/mod2/file2.h (exported by file2) ..... I think you got the picture How can I make function "bar()" exported by /foo/mod1/file1.c only to other files in /foo/mod1, without making it visible to mod2? Just omitting it from mod1.h won't work: someone could declare it extern in his/her file and use it. I'd like to make it foolproof. One solution that comes up to me is making a mod1.c file which is #include "file1.c" #include "file2.c" and using static functions/variables. Is there a more elegant way? Thanks
  • 2. Unicode Normalization of Text Streams
    Has it ever been proposed or posited within any C committee to define or discuss (in a standard's document) the transformation of Unicode text I/O according to a Unicode Normalization Form (assuming a locale which employs a Unicode representation)? Is such a capability implicit? The notion exists and seems to work well for line/record delimiters (e.g. "\r\n" -> "\n"). - Bill
  • 3. manipulating console output.
    Hi all, I'm doing a small c program which backs up the mbr of hard disk. Currently working in linux. what i did was : system("sudo dd if=/dev/sda of=mbr.bin bs=512 count=1"); This is the output i got from console. 1+0 records in 1+0 records out 512 bytes (512 B) copied, 7.6e-05 seconds, 6.7 MB/s is there anyway I can don't print these messages? or capture them and do some parsing such that i will be able to print my own messages? Thanks and best regards, Jackson
  • 4. Question on macro substitution
    Hi all, I have the following code , #include <stdio.h> #define f(a,b) a##b #define g(a) #a int main(void) { printf("%s\n",g(f(10,20))); return 0; } Output that i got is f(10,20) But i expected 1020 My assumption was 1) first f(10,20) is replaced by 1020 , because of macro f(a,b) concantenates its arguments 2) then g(a) macro replaces 1020 by a string literal "1020" 3) the output should be 1020 But why is f(10,20) not getting substituted. I'm sure i'm missing something here. Can someone explain me this program ? Thanks for your time, Yugi.

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 90 guest