2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 <2021> 2022 2023 2024 2025 | Index | 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 <2021> 2022 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Coding style question IOCFUNCDEF_HAS_USAGE |
From: | "Johnson, Andrew N. via Core-talk" <core-talk at aps.anl.gov> |
To: | Heinz Junkes <junkes at fhi-berlin.mpg.de> |
Cc: | EPICS core-talk <core-talk at aps.anl.gov> |
Date: | Wed, 13 Jan 2021 16:42:59 +0000 |
On Jan 13, 2021, at 7:03 AM, Heinz Junkes via Core-talk <core-talk at aps.anl.gov> wrote:
It doesn’t look as bad if you don’t use that huge indentation (personally I dislike that indent style, it gets line-wrapped in emails and any changes to the variable name mean you have to redo the number of spaces in the indentation of all the
lines below it). I would probably write it like this:
static const iocshFuncDef rtshellFuncDef = {
“rt”, 2, rtshellArgs
#ifdef IOCFUNCDEF_HAS_USAGE , “run rtems shell command” #endif }; You could also define your own macro:
#ifdef IOCFUNCDEF_HAS_USAGE
#define IOCSH_USAGE(msg) ,msg
#else
#define IOCSH_USAGE(msg)
#endif
Then the code becomes:
static const iocshFuncDef rtshellFuncDef = {
“rt”, 2, rtshellArgs
IOCSH_USAGE(“run rtems shell command”) }; - Andrew
--
Complexity comes for free, simplicity you have to work for.
|