Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

slugster

pointers arrrrg help

This topic is 6798 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

starcpu.h struct STARSCREAM_PROGRAMREGION { unsigned lowaddr; unsigned highaddr; unsigned offset; };__________________________________________________________ i also tried struct STARSCREAM_PROGRAMREGION { unsigned lowaddr; unsigned highaddr; unsigned *offset; };________________________________ main.c #include "68k/starcpu.h" #include unsigned char *ram; struct STARSCREAM_PROGRAMREGION pretend_programfetch[] = { {0x000000, 0x3fffff, (unsigned)ram }, {-1, -1, NULL} }; main(){ ..malloc and othe stuff here but ignore this for now }; this give me a error when i compileit like above. src/memmap.c:8: initializer element is not constant src/memmap.c:8: (near initialization for `pretend_programfetch[0].offset'') make.exe: *** [obj/memmap.o] Error 1 but NULL works fine, if i do this it works fine main.c #include "68k/starcpu.h" #include unsigned char *ram; struct STARSCREAM_PROGRAMREGION pretend_programfetch[] = { {0x000000, 0x3fffff, NULL }, {-1, -1, NULL} }; main(){ ..malloc and othe stuff here but ignore this for now pretend_programfetch[0].offset=(unsigned)rom; }; why cant i use this in the structure i am using djgpp (the dos port of gcc) i want the information in a structure but i doesnt look like c will allow it

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
C doesn''t like initializing structures with dynamic values. I would recommend compiling as C++ instead if you want to initialize a structure member with a variable.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!