06-03-2007
History.
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
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
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
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
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
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
I want address of current virtual memory block?
i am using fedora10:wall::wall: (1 Reply)
Discussion started by: powyama
1 Replies
7. Solaris
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
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
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
LEARN ABOUT REDHAT
gsignal
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)