Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!cs.umn.edu!sctc.com!stachour From: stachour@sctc.com (Paul Stachour) Newsgroups: comp.lang.c Subject: Re: Initializing a pointer inside a struct Message-ID: <1991Apr23.181344.11153@sctc.com> Date: 23 Apr 91 18:13:44 GMT References: <1991Apr17.105139.16331@fy.chalmers.se> Organization: SCTC Lines: 40 re: the problem >[] On 17 Apr 91 10:51:39 GMT, f90angu@fy.chalmers.se (Andreas Gunnarsson) said: >AG> I've tried this: >AG> struct >AG> { >AG> ... >AG> int *int_list; >AG> ... >AG> } list_of_structs[] = >AG> { >AG> { ..., {1, 2, 3, -1}, ...}, >AG> { ..., {4, -1}, ...}, >AG> . >AG> . >AG> . >AG> }; ===== The solution suggested was that one uses a set of statics, and then gives the pointer to those items. ----- Those trying the solution should be aware that many C compilers for embedded systems (e.g, multi-tasking C programs) cannot get the correct addresses into the initialized structures due to the way in which the compiler and run-time startup is built. I seldom have these problems on virtural-memory systems like Unix or on one-process physical memory systems like MS-DOS, but nearly every compiler I have ever used for C on top of physical-memory multi-porcess structures gets at least one of its addressing modes between "varieties of data" (such as static-static, static-const, static-exec, ...) wrong. ...Paul -- Paul Stachour SCTC, 1210 W. County Rd E, Suite 100 stachour@sctc.com Arden Hills, MN 55112 [1]-(612) 482-7467