EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: motor module compile problems
From: "Lang, Keenan C." <[email protected]>
To: "Johnson, Andrew N." <[email protected]>, "Rivers, Mark L." <[email protected]>, 'Jörn Dreyer' <[email protected]>, "[email protected]" <[email protected]>
Date: Wed, 8 Nov 2017 17:04:47 +0000

For what it's worth, Bjarne Stroustrup doesn't discourage the use of NULL, calling the use of "0" instead to be an aesthetic difference.


http://www.stroustrup.com/bs_faq2.html#null


It was discouraged in pre-standard code, but many of the reasons why it was discouraged largely still apply to the use of "0" and "\0". The current recommendation is to use C++11's nullptr keyword.




From: [email protected] <[email protected]> on behalf of Andrew Johnson <[email protected]>
Sent: Wednesday, November 8, 2017 10:27:16 AM
To: Rivers, Mark L.; 'Jörn Dreyer'; [email protected]
Subject: Re: motor module compile problems
 
On 11/08/2017 08:33 AM, Mark Rivers wrote:
> All of this code is C++.  In general it is recommended not to use NULL at
> all in C++, use 0 instead.  So I would suggest changing "(char) NULL" to "0".

To clarify and amplify what Mark wrote, the character with value zero
used to be named NUL (single L) in the old ASCII charts that I remember,
and I have also seen it called Nil. Apparently some people re-use the
macro NULL for this as in the code that Jörn showed, but to me doing so
is very confusing. I generally use 0 (no quotes) as Mark suggests, while
others use '\0' which explicitly tells the compiler that this is a char.

- Andrew

> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Jörn Dreyer
> Sent: Wednesday, November 08, 2017 8:13 AM
> To: [email protected]
> Subject: motor module compile problems
>
> Hi,
>
> I have had some trouble compiling the motor module (from git) on a openSuSE
> Tumbleweed system with gcc 7.2.1. It fails in all motor drivers at the calls
> of send_message where the last parameter is passed as (char) NULL. But in the
> definition of send_message the last parameter is defined as char*.
> What would be the correct fix for this? One could
> 1. modify all calls to send_message(..,..,(char) NULL) to
> send_message(..,..,(char*) NULL), or
> 2. modify the definition of send_message(..,..,char*)to
> send_message(..,..,char), but then other calls may fail.
>
> I chose  the first solution to get it compiled.  If needed I can send a patch
> file to correct all necessary lines.
>
> Regards,
>
> Jörn
>
>

--
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon

References:
motor module compile problems Jörn Dreyer
RE: motor module compile problems Mark Rivers
Re: motor module compile problems Andrew Johnson

Navigate by Date:
Prev: Re: motor module compile problems Andrew Johnson
Next: Re: areaDetector and HDF5 file saving segafaults Hinko Kocevar
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: motor module compile problems Andrew Johnson
Next: caget() from C++ Church, Eric D
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024