Stop Microsoft
		Miscellaneous => Programming & Networking => Topic started by: anphanax on 17 December 2003, 21:59
		
			
			- 
				First off, let me explain what i'm doing. I'm accessing VRAM (The VGA/EGA Offset) in a 320x200, 256 color environment. (Not that annoying 4-layer crap)
 
 /* This Works */
 unsigned char far *videoRAM = (unsigned char far *)0xA0000000L;
 
 /* This Doesn't:
 ERROR: Cannot convert 'unsigned long' to
 'unsigned char*' */
 unsigned char far *videoRAM = 0xA0000000L;
 
 Why do I need casting on memory locations?
 It's a location in memory, and has nothing
 really todo with the datatype, so i'm a bit
 confused.
 
 I posted this here because I tried getting an answer in a "computer" chat and no one seemed to know what I was talking about.
 
 [ December 17, 2003: Message edited by: anphanax ]
- 
				quote:
 anphanax: Why do I need casting on memory locations? It's a location in memory, and has nothing really todo with the datatype, so i'm a bit confused.
 
 
 
 Are you talking about the BIOS or the RAM? I'm confused now too  :confused:
- 
				It's just standard type-checking practice, and it depends on the compiler you're using. GCC (which I assume you're not using) would let you do it without a cast but would give you a warning.
			
- 
				Thanks for your help.