QueryCAT Logo
Search 5,000,000+ questions and answers.

Frequently Asked Questions

What is a far pointer? where we use it?

OOPS FAQ - Page 6
Latest Answer: near, far pointers are the types of pointers in C. By using these pointers we can directly access me...

What's a far pointer/FAR*?

Win32 FAQ
If you aren't programming 16-bit Windows, you don't need to worry about it. If you still wonder, here we start the long answer. In real mode, addresses are 20 bit quantities allowing access to 1 megabyte of memory, formed of a 16 bit offset and part of a 16-bit segment. For all practical purposes, the address was a 16 bit address, in the range 0 - 65535, since the standard operating system, DOS, could only use that range. All applications have access to all memory. See similar questions...

Why I deleted a pointer, then use it, I still get the same data?

FAQ on C/C++/Unix by Roseanne Zhang, Java Programmer Certifi...
Yes, sometimes, it still can be used to get the same value, sometimes it does not. Sometimes, you will get a segmentation error. The language does not check the validity of the pointer. The programmer is responsible to use the pointers responsiblely. That is one problem of c/c++, which are not a safe language, but it is highly efficient! The following sample program will demonstrate the concepts. See similar questions...

Should you use the this pointer in the constructor?

Constructors, C++ FAQ Lite
Some people feel you should not use the this pointer in a constructor because the object is not fully formed yet. However you can use this in the constructor (in the {body} and even in the initialization list) if you are careful. Here is something that always works: the {body} of a constructor (or a function called from the constructor) can reliably access the data members declared in a base class and/or the data members declared in the constructor's own class. See similar questions...

What Is A Pointer?

Windows Basics
A pointer is the arrow you use to choose things on screen. Since the Shortcut is simply a pointer to a specific program or file, you can delete the shortcut or remove it from the Desktop without actually deleting the program or file. See similar questions...

How can I peek at an address whose far pointer I get from an INT 21h call?

DJGPP Frequently-Asked Questions List
If you want to access a byte, a 16-bit word, or a 32-bit double word, use the "far pointer" functions declared on the the header file. You should convert any real-mode far pointer segment:offset pair into a linear address (i.e., segment*16 + offset), and use the _dos_ds macro to get the selector which allows access to conventional memory, like this: unsigned char value = _farpeekb(_dos_ds, segment*16 + offset); Use _farpeekw to peek at 16-bit shorts and _farpeekl to peek at 32-bit longs. See similar questions...

Is a null statement a null pointer?

Infrequently Asked Questions in comp.lang.c
No. A null pointer is a pointer where all of the address bits are zero (no matter what the segment bits are), and can be obtained by typing '(char *) (int) 0'. A null statement is not a pointer to anything. They are not interchangeable, although you can combine them to get an effectively-null statement, such as NULL;. This does not buy you anything. [a] Send large donations, checks, and money orders to the author of the FAQ, or the moderator of the group, whichever you prefer. See similar questions...

How far is it?

Frequently Asked Questions about the pilgrimage to Santiago ...
Roncesvalles to Santiago is about 800 km i.e. 4-5 weeks walking or 2 weeks by bike. Seville to Santiago, on the Via de la Plata, is 1000 km, walkable in about 6 weeks. Le Puy to Roncesvalles is about 5 weeks walking, Vézelay similar. Paris to Santiago is 2000 km. Arles to Puente la Reina is about 900 km. For descriptions of all the routes, click here. See similar questions...

Can I use static object instead of static pointer inside the singleton definition?

FAQ on C/C++/Unix by Roseanne Zhang
This code is actually the same as GoF's book. The singleton pattern is from many many programmers' industrial practice. Don't change it unless you are abosolute sure what you are doing. Just think a scenario, you have several huge different singletons using 2M or more memory each, and they are only needed in ~5 minutes once or once a day, however, your program is going to run 5 years continuously by 24*7. See similar questions...

Can I use a pointer to class/struct Node as a data member in the above question?

FAQ on C/C++/Unix by Roseanne Zhang, Java Programmer Certifi...
It is the programmer's responsibility to make sure your recursion code have a exit point!!! See the following code (borrowed from above question), no compiling errors, no linking errors, but the program will never print out the "after". struct Node { int num; Node *next; Node() { next = new Node(); //Infinite recursion!!! } }; int main() { printf("before\n"); Node a; //run out of memory, soon be dead! printf("after\n"); } See similar questions...

How unsafe is it to use (assign, compare) a pointer value after it's been freed?

Memory Allocation
When you call free, the memory pointed to by the passed pointer is freed, but the value of the pointer in the caller probably remains unchanged, because C's pass-by-value semantics mean that called functions never permanently change the values of their arguments. (See also question 4.8.) A pointer value which has been freed is, strictly speaking, invalid, and any use of it, even if it is not dereferenced (i.e. See similar questions...

If NULL and 0 are equivalent as null pointer constants, which should I use?

Null Pointers
Many programmers believe that NULL should be used in all pointer contexts, as a reminder that the value is to be thought of as a pointer. Others feel that the confusion surrounding NULL and 0 is only compounded by hiding 0 behind a macro, and prefer to use unadorned 0 instead. There is no one right answer. (See also questions 9.4 and 17.10.) C programmers must understand that NULL and 0 are interchangeable in pointer contexts, and that an uncast 0 is perfectly acceptable. See similar questions...

How do I create and use an array of pointer-to-member-function?

Pointers to member functions, C++ FAQ Lite
Note: #define macros are evil in 4 different ways: evil#1, evil#2, evil#3, and evil#4. But they're still useful sometimes. Feel ashamed, feel guilty, but when an evil construct like a macro improves your software, use it. See similar questions...

Why doesn't the construct-on-first-use idiom use a static object instead of a static pointer?

Constructors, C++ FAQ Lite
Short answer: it's possible to use a static object rather than a static pointer, but doing so opens up another (equally subtle, equally nasty) problem. Long answer: sometimes people worry about the fact that the previous solution "leaks." In many cases, this is not a problem, but it is a problem in some cases. See similar questions...

what is a NULL Pointer? Whether it is same as an uninitialized pointer?

OOPS FAQ - Page 7
Latest Answer: NULL pointer is pointer which is not pointing to anything in the memory. NULL is defined as (v... See similar questions...

Why can't I perform arithmetic on a void * pointer?

Infrequently Asked Questions in comp.lang.c
You're too big and clumsy. When you try to push the numbers together, you lose your balance. Perhaps you should get some angels from the rave over on pin 3. See similar questions...

Explore Other Topics

Can I use a USB to Ethernet adapter to connect the USB modem to my network?
What is SWIFT and how does it work?
What are the different types of abuse/neglect?
What time does it get dark in each season?
Question: How much is shipping? What about sales tax?
What is the difference between angina and a heart attack?
Where can I find official rules for Advanced HeroQuest?
What is on each disc?
What role, if any, has Hulk Hogan played in the Clique?
How does weather affect satellite TV reception?
What are the differences between WebMail and using an email program such as Outlook Express?
How do I get the balance on my Gift Card?
How do I get an allotment?
Can I mount a network drive via VPN?
More Questions >>

© Copyright 2007-2012 QueryCAT
About • Webmasters • Contact