kbesrl@ux1.cso.uiuc.edu (09/29/90)
Hello, I am trying to compile the fillowing piece of code (part of a larger file from GNU distribution) on RISC/Ultrix (DECstation 3100) and I get the following error. I would really appreciate if someone could help me out. Thanks. -- sudhakar sudha@kbesrl.me.uiuc.edu CODE: ----- Lisp_Object FormatIntegerProperty(buff,count,format) VOID *buff; unsigned long count; int format; { switch (format) { case 8 : return FormatInteger8Property((char *)buff,count); case 16 : return FormatInteger16Property((int16 *)buff,count); case 32 : return FormatInteger32Property((long *)buff,count); default : return Qnil; } } ERROR: ------ ccom: Error: property.c, line 128: buff undefined case 8 : return FormatInteger8Property((char *)buff,count); -------------------------------------------------------^ (ccom): property.c, line 130: cannot recover from earlier errors: goodbye! }
roj@dodads.dco.dec.com (Roger Masse) (10/03/90)
In article <22100017@ux1.cso.uiuc.edu>, kbesrl@ux1.cso.uiuc.edu writes: |> I am trying to compile the fillowing piece of code (part of a larger file from GNU distribution) |> on RISC/Ultrix (DECstation 3100) and I get the following error. |> CODE: |> ----- |> Lisp_Object |> FormatIntegerProperty(buff,count,format) |> VOID *buff; |> unsigned long count; |> int format; |> { |> switch (format) |> { |> case 8 : return FormatInteger8Property((char *)buff,count); |> case 16 : return FormatInteger16Property((int16 *)buff,count); |> case 32 : return FormatInteger32Property((long *)buff,count); |> default : return Qnil; |> } |> } !> ERROR: !> ------ !> ccom: Error: property.c, line 128: buff undefined I don't know how or if you have VOID defined, but I changed VOID to void, and it compiled fine. Regards, Roger Masse' 8301 Professional Place Digital Equipment Corporation Landover, Maryland, 20785 Washington ULTRIX Resource Center Internet: roj@dco.dec.com uucp: decvax!decuac!roj Disclaimer: My opinions do not necessarily represent anything.
peter@objy.objy.com (Peter Moore) (10/04/90)
<< The original author was having trouble with a parameter that was declared
void * >>
I have found that under Ultrix 3.x, the C compiler does not properly handle
void * parameters. The code:
foo(a)
void *a;
{
*(int *) = 5;
}
will give error messages about `a' being undefined. It looks like
it recognizes void only sort of as a type. It accepts the
declaration, but doesn't actually define a variable. There is an
easy workaround, use char * instead of void *.
Peter Moore
peter@objy.com
frank@croton.nyo.dec.com (Frank Wortner) (10/04/90)
> I have found that under Ultrix 3.x, the C compiler does not properly handle > void * parameters. The code: > > foo(a) > void *a; > { > *(int *) = 5; > } > > will give error messages about `a' being undefined. Fixed in 4.0. BTW, the fourth line should read: *(int*)a = 5; Regards, Frank