473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How does the huge pointer work in the c language

I can not understand huge pointer, please tell me how its working.

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>/ *How its working &decleration*/
  2. int main(){
  3. int huge *a =(int huge *)0x59990005;
  4. int huge *b =(int huge *)0x59980015;
  5. if(a == b)
  6. printf("power of pointer");
  7. else
  8. printf("power of c");
  9. return 0;
  10. }
Feb 25 '13 #1
4 2307
weaknessforcats
9,208 Expert Mod 8TB
int huge *a =(int huge *)0x59990005;
int huge *b =(int huge *)0x59980015;

First, you have two different literals (0x59990005 and 0x59980015) which will be in two different places in memory so their addresses will never be the same.

Second, why are you trying to make these literals into an int address? Neither of these lierals is a valid address.
Feb 25 '13 #2
Banfa
9,065 Expert Mod 8TB
If memory serves me huge pointers stem from 16 bit windows where huge was one of the available memory models and you needed a huge pointer to point into the extended data segment of programs using this model (this may not be exactly right because frankly it is a long time since I have thought about it).

Anyway in that memory model memory was in segments with a 16 bit address but you also had a 16 bit segment what indicated which segment of memory to use the address in.

However it is more complicated than that because the memory segments where not sequential but rather overlapped somewhat.

So my guess is that if you where actually using the huge memory model then the 2 given literals when converted to pointers would in fact reference the same address and test equal resulting in the text "power of pointer" being printed.

This is all rather academic since the huge memory model has not seen the light of day in many years, since the advent of WIN32 and a flat 32 bit virtual address space for each process.
Feb 25 '13 #3
donbock
2,426 Expert 2GB
Just to be clear: huge pointers are an implementation-specific extension to the language. They are not described in the C Standard. Programs that use them are not portable.
Feb 25 '13 #4
thanks for your post
Feb 25 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: anon | last post by:
How *EXACTLY* does Smart Navigation work? (I would really really really like for this Smart Navigation to work in Mozilla.) The inner workings and the code is what I am looking for. Does it...
1
by: John | last post by:
Hi, Does Dotfuscator really work? I mean is there no way to decompile your program when it's done? Or does it just make it more difficult to work with the decompiled code? Also, is there...
9
by: chandramohan.mani | last post by:
Does Event handlers work in netscape. If yes means can anyone please help me. <HTML><SCRIPT LANGUAGE="JScript"> function mouseclick() { alert("I was clicked on " +...
12
by: Frank Hauptlorenz | last post by:
Hello Out there! I have a DB2 V7.2 Database (Fix11) on Win 2000 Professional. It was before a NT 4 based Domain - now it is a Win 2000 Domain. The database server is a domain member. Now...
5
by: Niu Xiao | last post by:
I saw a lot of codes like: void foo(void* arg) void bar(void** arg) f((void*)p) but what does void pointer mean in c? I just know it stands for generic pointer. thanks.
14
by: jagguy | last post by:
this works char *p ; p="xat"; cout << p <<endl;
5
by: cpdar | last post by:
typedef struct FileHdr { unsigned long reg; unsigned short width; float sfactor; struct FileHdr huge *next; }FileHdr; FileHdr huge *Hdrhead=NULL,huge *Hdrcur=NULL; // //
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.