Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #140104
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: compiling [old] c code |
| Date | 2019-01-23 02:12 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <87tvi0xgtu.fsf@bsb.me.uk> (permalink) |
| References | (6 earlier) <048927d3-9039-4cce-84a2-1eec71d65eb5@googlegroups.com> <87fttkzllq.fsf@bsb.me.uk> <53d95acc-3eb2-4bee-9b44-6c4a2fd638f3@googlegroups.com> <875zugz4yy.fsf@bsb.me.uk> <4eb0bf48-2998-4d5c-9ed8-b1b5edf5c5f4@googlegroups.com> |
fir <profesor.fir@gmail.com> writes: > W dniu wtorek, 22 stycznia 2019 23:45:50 UTC+1 użytkownik Ben Bacarisse napisał: >> fir <profesor.fir@gmail.com> writes: >> >> > W dniu wtorek, 22 stycznia 2019 17:46:35 UTC+1 użytkownik Ben Bacarisse napisał: >> >> fir <profesor.fir@gmail.com> writes: >> >> >> >> > W dniu poniedziałek, 21 stycznia 2019 19:34:08 UTC+1 użytkownik Ben Bacarisse napisał: >> <snip> >> >> >> Apart form the "big union" idea that's already been mentioned, you coud >> >> >> try a macro: >> >> >> >> >> >> #define PTR(p, s) ((struct s *)(p)) >> >> >> >> >> >> and re-write things like >> >> >> >> >> >> ttype = t->vtype; >> >> >> >> >> >> as >> >> >> >> >> >> ttype = PTR(t, varblock)->vtype; >> >> >> >> >> >> You might even be able to automate this a bit by using something like >> >> >> Perl to record what structs have what members. >> >> > >> >> > it seems to me that he dont need to rewrite field acceses only >> >> > maybe put >> >> > >> >> > ptr = (struct some*) ptr; //? >> >> > >> >> > in thet few places >> >> >> >> This would be a constraint violation and yet would achieve nothing. >> >> >> > what do you mean? you cant cast pointer >> > on another type of pointer? >> >> ptr is of type int *. Assigning a struct some * to an int * object is >> an error. C, however, does not really have errors -- it has situations >> that compiler must report. These are called constraint violations and >> your assignment is an example of one. >> >> Your suggestion does not achieve anything because it does not solve the >> problem. You can't access the struct member after the assignment any >> more that you could before. >> > well it may be, i dont remember such (in a way) silly details (details > that can be seen as silly in some way) No, ptr = (struct some*) ptr; does nothing but make the program undefined. <snip> -- Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
compiling all c code fiziqs@gmail.com - 2019-01-20 14:51 -0800
Re: compiling all c code Richard Damon <Richard@Damon-Family.org> - 2019-01-20 18:41 -0500
Re: compiling all c code gazelle@shell.xmission.com (Kenny McCormack) - 2019-01-20 23:42 +0000
Re: compiling all c code Geoff <geoff@invalid.invalid> - 2019-01-20 16:44 -0800
Re: compiling all c code fiziqs@gmail.com - 2019-01-21 02:36 -0800
Re: compiling [old] c code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-21 12:20 +0000
Re: compiling [old] c code fiziqs@gmail.com - 2019-01-21 04:58 -0800
Re: compiling [old] c code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-21 18:33 +0000
Re: compiling [old] c code fir <profesor.fir@gmail.com> - 2019-01-22 04:21 -0800
Re: compiling [old] c code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-22 16:46 +0000
Re: compiling [old] c code fir <profesor.fir@gmail.com> - 2019-01-22 10:35 -0800
Re: compiling [old] c code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-22 22:45 +0000
Re: compiling [old] c code fir <profesor.fir@gmail.com> - 2019-01-22 14:58 -0800
Re: compiling [old] c code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-23 02:12 +0000
Re: compiling [old] c code fir <profesor.fir@gmail.com> - 2019-01-23 00:59 -0800
Re: compiling [old] c code fir <profesor.fir@gmail.com> - 2019-01-22 03:34 -0800
Re: compiling [old] c code fir <profesor.fir@gmail.com> - 2019-01-22 04:08 -0800
Re: compiling all c code Keith Thompson <kst-u@mib.org> - 2019-01-21 14:23 -0800
csiph-web