assembly in future C standard HCF Gerry Wheeler

c

    Sponsored Links

    Next

  • 1. Help me..!
    Hi All, I completed my B.Sc. I want to settle as a s/w Tester that why I had learned Testing Tools. Please give ur suggestions to achieve my target. I dont have any experience in s/w Testing. Please help me in this regard. Regards, Shankar
  • 2. Learning
    suggest me some books which are available on net to learn c language.
  • 3. Saving data
    I'm trying to write a little function to save data. Basically I have a large 2d array of structs, so I'm going to have to call the save function once per struct in the array. I'd like to save the data using fwrite(). After quite a lot of effort I've come up with the code below, but I'm having real difficulty getting rid of the last error. When compiling, I get this: Line 52: "warning: assignment makes pointer from integer without a cast" I'm not sure what's causing this but it's very confusing. Can anyone help? Simon --Code below-- #include <stdio.h> struct test { char char1; char char2; char char3; char char4; int* pointer1; int* pointer2; }; main() { struct test test_st[3][3]; int i, j; for (j = 0; j < 3; j++) { for (i = 0; i < 3; i++) { test_st[j][i].char1 = 1; test_st[j][i].char2 = 1; test_st[j][i].char3 = 1; test_st[j][i].char4 = i; test_st[j][i].pointer1 = NULL; test_st[j][i].pointer2 = NULL; } } FILE *fp = fopen ("test.csd_saved_game", "w"); struct test *p; p = &test_st[j][i]; write_struct (fp, p); /* p -> char1; fwrite (p, 1, 1, fp); fread (test_char, */ return 0; } write_byte (FILE *fp, unsigned char *temp, int bytes) { fwrite (temp, 1, bytes, fp); } write_struct (FILE *fp, struct test *p) { unsigned char *temp; temp = p -> char1; <<<<ERROR IS HERE write_byte (fp, temp, sizeof(char)); }

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.

w..


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++ ) {
    foo();
    /* ... */
  }
#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)gmail.com      | don't, I need to know.  Flames welcome.



Return to c

 

Who is online

Users browsing this forum: No registered users and 23 guest