implicit casting

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2008
Posts: 3
Reputation: SphinCorp is an unknown quantity at this point 
Solved Threads: 0
SphinCorp SphinCorp is offline Offline
Newbie Poster

implicit casting

 
0
  #1
Nov 11th, 2008
I am getting a casting error with:
  1. page_directory[0] = page_table;

where

  1. unsigned long *page_directory = (unsigned long *) 0x9C000;
  2. unsigned long *page_table = (unsigned long *) 0x9D000;

Note that this is to initialize paging at kernel level, so stdlib.h is NOT an option, as malloc() -- a memory allocation function -- is to be part of the memory manager this calls. how would I explicitly type-cast that?
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,810
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 747
Team Colleague
Narue's Avatar
Narue Narue is online now Online
Code Goddess

Re: implicit casting

 
1
  #2
Nov 12th, 2008
Well, what's the type of page_directory[0]? page_directory is a pointer to unsigned long, right? So after an offset and dereference you'd be looking at an unsigned long, thus:
  1. page_directory[0] = (unsigned long)page_table;
That will make your error go away.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC