C to Pascal translation.

Robert Viduya robert at gitpyr.UUCP
Tue Dec 18 17:20:32 AEST 1984


> 
> 	union u {
> 		int (*f)();
> 		char *c;
> 	} u;
> 	h() {
> 		u.c = "foo";
> 	}
> 	g() {
> 		u.f = h;
> 	}
> 	main () {
> 		g();
> 		(*u.f)();
> 		printf("%s\n", u.c);
> 	}
> 
> If you make some restrictions, then it can sort of be done.

Actually, the restriction is not in the unions.  Pascal can handle the
concept of unions by using variant records with no tag field specifier.
The restriction of translating C to Pascal is that Pascal does not support
pointers to functions.

			robert
-- 
Robert Viduya
Office of Computing Services
Georgia Institute of Technology, Atlanta GA 30332
Phone:  (404) 894-4669

...!{akgua,allegra,amd,hplabs,ihnp4,masscomp,ut-ngp}!gatech!gitpyr!robert
...!{rlgvax,sb1,uf-cgrl,unmvax,ut-sally}!gatech!gitpyr!robert



More information about the Comp.lang.c mailing list