|
John R. Shaw wrote: Do you know what a long pointer is? I do.
long pointers are used to access memory that is located in the other segment(intersegment).
Am I right?
Regards,
Arun Kumar.A
|
|
|
|
|
Actually no! Long pointers are not used any more and where used to overcome the limitations of PC memory access. The PC was limited to accessing only 64k, minus a few bytes for the systems use, so that was the max you could allocate with standard C (malloc). A normal pointer was only 16 bits, and a long pointer was a 32 bit pointer which required the compiler to generate code that allowed you to access more that 64k. Microsoft had the keyword ‘_far’ which told the compiler to make the pointer 32 bits instead of 16 bits and generate the required code. When Windows 95 came along and VC6 came out the ‘_far’ keyword was no longer supported, because it was not longer needed. All the ‘lp’ references in the code no longer mattered because all the pointers where now the same size, but if your previous code used the macro definitions like ‘LPSTR’ then it would still compile without error because the macros had been changed. If you had used the keyword ‘_far’ in any of your code, then you had to go in and remove it so you could compile the same code on the new compiler.
That is pretty much it, ‘lp’ means ‘p’ now days.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Thank you very much for your reply.
But, in C Language, how to access the memory 0xb8000000
which is the memory address for VDU.
Similarly , how to execute the POST function
located at 0xffff000 without far pointer?
Regards,
Arun Kumar.A
|
|
|
|
|
Now days: unsigned char* p = (unsigned char*)0xB8000000L;
Old days: unsigned char _far* p = (unsigned char _far*)0xB8000000L;
Used to do stuff like that all the time to directly access video memory and other hardware, but modern operating systems do not allow that any more. Accept for older code, which it places in a sandbox (its own processing space) so it can keep an eye on it, and even then it may not allow it. Direct access now requires a driver down at ring 0 to access hardware directly, but there is usually something like DirectX that does it for you.
Note that both the addresses you mentioned are 32 bit and are therefore just ordinary pointers on a 32 bit machine.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
|
A fragment found indicating a similar naming blunder encountered in our code...
szCallerName.GetBuffer(0)
|
|
|
|
|
The rule is best when used in spirit in more degree and emphasis than in letter. There used to be one lesson in my tenth standard English book "All about the dog". I forgot the author. It used to emphasize this letter vs spirit.
|
|
|
|
|
__gc struct G
{
int i;
};
__value struct V
{
int i;
};
int main()
{
// defaults to V __gc * __nogc * ppV;
V ** ppV;
// defaults to V __gc * __nogc * __nogc * pppV;
V *** pppV;
// defaults to G __gc * __gc * ppG;
G ** ppG;
// defaults to G __gc * __gc * __nogc * pppG;
G *** pppG;
// defaults to G __gc * __gc * __nogc * __nogc * ppppG;
G **** ppppG;
}
Thanks,
Syed
|
|
|
|
|
"Do not post programming questions in this forum. This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed."
Marked as spam.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Wow - I wish I could say this was a new record. Somebody posting exactly question to the same forum, and ignoring the fact that the original was removed because this wasn't the right place to ask the question.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I think the OP is the epitome for my sig.
Cheers,
Vıkram.
Déjà moo - The feeling that you've seen this bull before.
Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
|
i suspect a language issue.
|
|
|
|
|
Yeah... in syedhasan's native language, MC++ translates to "Horrors".
...oh, wait, that'd be English...
----
i hope you are feeling sleepy for people not calling you by the same.
--BarnaKol on abusive words
|
|
|
|
|
Shog9 wrote: MC++ translates to "Horrors".
hmmm. i thought MC++ was the new fat-n-proud rapper from Redmond...
|
|
|
|
|
Heh.
----
i hope you are feeling sleepy for people not calling you by the same.
--BarnaKol on abusive words
|
|
|
|
|
Hmmm. Coders from the hood. It's got a certain appeal to it.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
<br />
for (int c = 0; c < _myHand.CardCount; c++)<br />
{<br />
if (_myHand.Cards[c].Equals(1))<br />
e[1] = e[1] + 1;<br />
else<br />
if (_myHand.Cards[c].Equals(2))<br />
e[2] = e[2] + 1;<br />
else<br />
if (_myHand.Cards[c].Equals(3))<br />
e[3] = e[3] + 1;<br />
else<br />
if (_myHand.Cards[c].Equals(4))<br />
e[4] = e[4] + 1;<br />
else<br />
if (_myHand.Cards[c].Equals(5))<br />
e[5] = e[5] + 1;<br />
else<br />
if (_myHand.Cards[c].Equals(6))<br />
e[6] = e[6] + 1;<br />
else<br />
if (_myHand.Cards[c].Equals(7))<br />
e[7] = e[7] + 1;<br />
else<br />
if (_myHand.Cards[c].Equals(8))<br />
e[8] = e[8] + 1;<br />
else<br />
if (_myHand.Cards[c].Equals(9))<br />
e[9] = e[9] + 1;<br />
else<br />
if (_myHand.Cards[c].Equals(10))<br />
e[10] = e[10] + 1;<br />
else<br />
if (_myHand.Cards[c].Equals(12))<br />
e[12] = e[12] + 1;<br />
else<br />
if (_myHand.Cards[c].Equals(13))<br />
e[13] = e[13] + 1;<br />
else<br />
if (_myHand.Cards[c].Equals(14))<br />
e[14] = d[14] + 1;<br />
<br />
}<br />
This is just great And this thing doesn't appear at one place, but all over the code!
Mostly, when you see programmers, they aren't doing anything. One of the attractive things about programmers is that you cannot tell whether or not they are working simply by looking at them. Very often they're sitting there seemingly drinking coffee and gossiping, or just staring into space. What the programmer is trying to do is get a handle on all the individual and unrelated ideas that are scampering around in his head. (Charles M Strauss)
|
|
|
|
|
Oh, my eyes, my eyes!
Why 14? What's in e[0]? Is that d[14] a typo?
|
|
|
|
|
I wish to know that
Mostly, when you see programmers, they aren't doing anything. One of the attractive things about programmers is that you cannot tell whether or not they are working simply by looking at them. Very often they're sitting there seemingly drinking coffee and gossiping, or just staring into space. What the programmer is trying to do is get a handle on all the individual and unrelated ideas that are scampering around in his head. (Charles M Strauss)
|
|
|
|
|
PIEBALDconsult wrote: What's in e[0]?
e[0]? Whats e[0]?
Indices are starting from one, ever since VB existed!
If you are really oldscool, you may even substitute VB with Fortran...
Failure is not an option - it's built right in.
|
|
|
|
|
Wow, that is absolutely horrible. I've seen some bad programmers in high school, and this type of code would fit right in there.
What a shame
|
|
|
|
|
But in school the teacher would (should) point the offender in the right direction.
One of the benefits that schools have over books.
|
|
|
|
|
Ah, but we DID have an excellent high school teacher. He is still one of my favorite teachers/professors of all time. He was always doing his best to solve people's programming "mistakes" and send them in the right direction.
We also had a set of TAs that would help the class learn and code, and they were really helpful. Alas, all the "good" programmers also became TAs by sheer force and there was little you could do to avoid being asked for help five times per class *laughs*
In the end, however, some people are beyond hopeless for becoming programmers and should quit while they're not too far behind. I see bad examples of programmers even in college as a Junior (now almost a Senior). I'm amazed how some people made it this far!
|
|
|
|
|
hah
the horrible poker code I saw in HS didn't use arrays or parameter passing. everything was stored in global variables.
I probably had as much to do with cluebatting my classmate out of that nonsense as did the teacher. :->
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|