| | |
implicit casting
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2008
Posts: 3
Reputation:
Solved Threads: 0
I am getting a casting error with:
where
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?
C Syntax (Toggle Plain Text)
page_directory[0] = page_table;
where
C Syntax (Toggle Plain Text)
unsigned long *page_directory = (unsigned long *) 0x9C000; 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?
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:
That will make your error go away.
c Syntax (Toggle Plain Text)
page_directory[0] = (unsigned long)page_table;
I'm here to prove you wrong.
![]() |
Similar Threads
- Differences Between Java and C/C++ (C++)
- Casting in C++ (C++)
- Type casting and type conversions (C)
- Type casting (C++)
- type casting (C++)
Other Threads in the C Forum
- Previous Thread: input validation
- Next Thread: Returning counters to 0 ?
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays bash binarysearch centimeter char convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic fflush file fork frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hardware highest homework i/o ide inches infiniteloop initialization interest kilometer km lazy linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix meter microsoft motherboard multi mysql open opendocumentformat opensource openwebfoundation owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling segmentationfault send shape single socketprograming socketprogramming spoonfeeding stack standard strchr string strings structures suggestions system systemcall test testautomation unix user voidmain() wab win32api windows.h






