Skip to Content.
Sympa Menu

perfsonar-user - [perfsonar-user] (void*)!NULL

Subject: perfSONAR User Q&A and Other Discussion

List archive

[perfsonar-user] (void*)!NULL


Chronological Thread 
  • From: Brian Candler <>
  • To: "" <>
  • Subject: [perfsonar-user] (void*)!NULL
  • Date: Wed, 10 Dec 2014 18:27:44 +0000

I am going through the bwctl code to fix compiler warnings (some of
which are serious, e.g. strncat potentially going 1 byte over end of buffer)

One thing I'm not sure about is the expression ((void*)!NULL) which
occurs in these places:

./bwctl/bwctl.c: *closure = (void *)!NULL;
./bwctl/bwctl.c: if(
!BWLContextConfigSet(ctx,BWLChildWait,(void*)!NULL)){
./bwctld/bwctld.c: if(
!BWLContextConfigSet(ctx,BWLChildWait,(void*)!NULL)){
./bwctld/bwctld.c: if(
!BWLContextConfigSet(ctx,BWLChildWait,(void*)!NULL)){

Now, (!NULL) == (!0) == 1. As a pointer this is almost certainly
invalid, so I guess it's just being used as a NULL or not-NULL test
somewhere.

The warning is:

bwctld.c:2290:59: warning: cast to 'void *' from smaller integer type 'int'
[-Wint-to-void-pointer-cast]
if( !BWLContextConfigSet(ctx,BWLChildWait,(void*)!NULL)){

Maybe (void*)1L is a clearer indication of intention?

Regards,

Brian.

________________________________
Brian Candler
Systems Architect

________________________________

[CityFibre] [Follow CityFibre on Twitter] <http://www.twitter.com/CityFibre>
[Follow CityFibre on LinkedIn] <http://www.linkedin.com/company/cityfibre>
CityFibre,
15 Bedford Street,
,
WC2E 9HE

0845 293 0774
Web: www.cityfibre.com<http://www.cityfibre.com>

Disclaimer
CityFibre Holdings Limited is incorporated in England (No. 07488363) and its
registered office is 15 Bedford Street, London WC2E 9HE. This email, together
with any attachments, is confidential and for use by the addressee(s) only.
If you are not the intended recipient, please notify the sender immediately,
delete the message from your system and do not copy, use, distribute or
disclose the email, its contents or attachments for any purpose. CityFibre
Holdings Ltd accepts no liability for damage caused to a recipient's system
by this email nor for any unauthorised access to or interference with this
email.


  • [perfsonar-user] (void*)!NULL, Brian Candler, 12/10/2014

Archive powered by MHonArc 2.6.16.

Top of Page