Sponsored Content
Full Discussion: Pure Virtual Function in C++
Top Forums Programming Pure Virtual Function in C++ Post 302120069 by porter on Sunday 3rd of June 2007 04:11:07 PM
Old 06-03-2007
History. Smilie

If I have a function pointer in C

typedef int (*foo_ptr)(void);
foo_ptr my_foo;

I can either

(a) leave it to be undefined and a danger to all who touch it

(b) set it to point to an implementation of foo()

(c) set it to NULL or (foo_ptr)0 so people can check it's validity.

C++ is derived from C and setting it to 0 is an indication that this class does not provide an implementation of this function.

There are other places where a non-zero initialisation of a pointer is special such as the SIG_IGN/SIG_DFL and _XtInherit.

Unless you are either (a) implementing a C++ compiler (b) answering a homework question, the reason why is not actually important.
 

9 More Discussions You Might Find Interesting

1. Programming

Sharing C++ Objects with virtual function table pointers

I am pondering the next question: Can I safely sare objects that have virtual functions (i.e. have virtual function table pointers) between two processes ? Where will the pointers point to in each process ? What I am afraid of is that in the creating process the pointer will indeed point to... (2 Replies)
Discussion started by: Seeker
2 Replies

2. UNIX for Advanced & Expert Users

Differentiating between Virtual and non Virtual IP addresses

Hello, I would like to know if there is a command or any configuration file to find and differentiate the Virtual IP Addresses (of the Cluster Resource Group) and the IP Address of the Cluster Node. I observe that the ifconfig -a command returns all the IP addresses configured on the ... (1 Reply)
Discussion started by: vineetd
1 Replies

3. UNIX for Dummies Questions & Answers

Need to check all virtual hostnames/virtual IP's

Hi Folks, I want to check all the virtual hostname's/IP's of a host/ip. Currently we are using HP-UX and open SuSe. Please tell me the command to list out all virtual names of a particular host. many thanks in advance. (2 Replies)
Discussion started by: sai21
2 Replies

4. Solaris

Is there any Virtual data center as we have Virtual Machine?

Do we have any Virtual Data Center software as we have Virtual Machine? I want to practice everything of Solaris practically but i don't have resources like data center which includes Servers, Data storages, switches, and other things. (2 Replies)
Discussion started by: karman0931
2 Replies

5. UNIX for Dummies Questions & Answers

Have to log out of a virtual terminal twice in order to exit virtual terminals

Not really a newbie, but I have a strange problem and I'm not sure how to further troubleshoot it. I have to log out of a virtual terminal by typing exit, then exit again as in: woodnt@toshiba-laptop ~ $ exit logout woodnt@toshiba-laptop ~ $ exit logout I DON'T have to do this when I'm... (1 Reply)
Discussion started by: Narnie
1 Replies

6. UNIX for Advanced & Expert Users

What is the function to get address of the virtual memory block in linux??

I want address of current virtual memory block? i am using fedora10:wall::wall: (1 Reply)
Discussion started by: powyama
1 Replies

7. Solaris

Change hostID of Solaris 10 virtual/guest machine installed by Virtual Box 4.1.12 on Windows-XP host

Trying to set or modify the randomly set hostID of a Solaris 10 virtual/guest machine that I installed on a Windows-XP host machine (using Virtual Box 4.1.12). I was able to set/modify the hostname of the Solaris 10 virtual/guest machine during installation as well as via the Virtual Box... (4 Replies)
Discussion started by: Matt_VB
4 Replies

8. Programming

Pure C function pointer on printing vowels twice

Have difficulty to understand this pure C code to only print vowels twice from input string. Questions are commented at the end of each place. #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <limits.h> /* *Demonstrate the use of dispatch tables */ /*Print a char... (11 Replies)
Discussion started by: yifangt
11 Replies

9. UNIX for Beginners Questions & Answers

Providing virtual machine priority in kvm based virtual machines

Hi All, Is there any way I can prioritize my VMs when there is resource crunch in host machine so that some VMs will be allocated more vcpu, more memory than other VMs in kvm/qemu hypervisor based virtual machines? Lets say in my cloud environment my Ubuntu 16 compute hosts are running some... (0 Replies)
Discussion started by: SanjayK
0 Replies
GSIGNAL(3)						     Linux Programmer's Manual							GSIGNAL(3)

NAME
gsignal, ssignal - software signal facility SYNOPSIS
#include <signal.h> typedef void (*sighandler_t)(int); int gsignal(signum); sighandler_t ssignal(int signum, sighandler_t action); DESCRIPTION
Don't use these functions under Linux. Due to a historical mistake, under Linux these functions are aliases for raise() and signal(), respectively. Elsewhere, on SYSV-like systems, these functions implement software signalling, entirely independent of the classical signal and kill func- tions. The function ssignal() defines the action to take when the software signal with number signum is raised using the function gsig- nal(), and returns the previous such action or SIG_DFL. The function gsignal() does the following: if no action (or the action SIG_DFL) was specified for signum, then it does nothing and returns 0. If the action SIG_IGN was specified for signum, then it does nothing and returns 1. Otherwise, it resets the action to SIG_DFL and calls the action function with parameter signum, and returns the value returned by that function. The range of possible values signum varies (often 1-15 or 1-17). CONFORMING TO
SVID2, XPG2. These functions are available under AIX, DG-UX, HPUX, SCO, Solaris, Tru64. They are called obsolete under most of these sys- tems, and are broken under Linux libc and glibc. Some systems also have gsignal_r() and ssignal_r(). SEE ALSO
kill(2), signal(2), raise(3) notGNU 2002-08-25 GSIGNAL(3)
All times are GMT -4. The time now is 05:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy