Re: debugassert vs assert in apps

2024-01-08 Thread Tim Hardisty
Would a variation on this proposal be to add app-specific NXAPP_DEBUGASSERT etc.? This would then be "global" but unique to apps, not overlap with O/S DEBUGASSERTs, and make for a simpler global search/replace of current DEBUGASSERT in apps, and just need a one-off new set of entries in the app

Re: debugassert vs assert in apps

2024-01-04 Thread Tim Hardisty
If someone can post with a consensus/decision once there is one, it would be most useful! On 03/01/2024 17:35, Fotis Panagiotopoulos wrote: Just to be clear, I am always referring to the standard C assert() function/macro. Not the unconditional NuttX ASSERT() macro. Notice the capitalization!

Re: debugassert vs assert in apps

2024-01-03 Thread Fotis Panagiotopoulos
Just to be clear, I am always referring to the standard C assert() function/macro. Not the unconditional NuttX ASSERT() macro. Notice the capitalization! (Which is another confusing point worth improving... +1 for NX_ASSERT() ) On Wed, Jan 3, 2024 at 7:32 PM Fotis Panagiotopoulos wrote: > I am

Re: debugassert vs assert in apps

2024-01-03 Thread Fotis Panagiotopoulos
I am sorry, but I still don't see the difference. See this line here: https://github.com/apache/nuttx/blob/master/include/assert.h#L119 When NDEBUG is defined, assert also compiles to nothing. As it ought to do. (NDEBUG definition is also controlled by Kconfig, with CONFIG_NDEBUG) So, is there

Re: debugassert vs assert in apps

2024-01-03 Thread Tomek CEDRO
+1 :-) -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info On Wed, Jan 3, 2024, 17:44 Gregory Nutt wrote: > +1 > > On 1/3/2024 10:43 AM, Nathan Hartman wrote: > > On Wed, Jan 3, 2024 at 11:22 AM Gregory Nutt > wrote: > >> On 1/3/2024 10:11 AM, Fotis Panagiotopoulos wrote: > That would seem a

Re: debugassert vs assert in apps

2024-01-03 Thread Gregory Nutt
+1 On 1/3/2024 10:43 AM, Nathan Hartman wrote: On Wed, Jan 3, 2024 at 11:22 AM Gregory Nutt wrote: On 1/3/2024 10:11 AM, Fotis Panagiotopoulos wrote: That would seem a little odd since there was a PR a few years ago to change all instances of assert/ASSERT to DEBUGASSERT to save code size.

Re: debugassert vs assert in apps

2024-01-03 Thread Nathan Hartman
On Wed, Jan 3, 2024 at 11:22 AM Gregory Nutt wrote: > > On 1/3/2024 10:11 AM, Fotis Panagiotopoulos wrote: > >> That would seem a little odd since there was a PR a few years ago to > > change all instances of assert/ASSERT to DEBUGASSERT to save code size. > > > > How is that so? > > > > As I see

Re: debugassert vs assert in apps

2024-01-03 Thread Gregory Nutt
On 1/3/2024 10:11 AM, Fotis Panagiotopoulos wrote: That would seem a little odd since there was a PR a few years ago to change all instances of assert/ASSERT to DEBUGASSERT to save code size. How is that so? As I see here: https://github.com/apache/nuttx/blob/master/include/assert.h#L122 asser

Re: debugassert vs assert in apps

2024-01-03 Thread Fotis Panagiotopoulos
> That would seem a little odd since there was a PR a few years ago to change all instances of assert/ASSERT to DEBUGASSERT to save code size. How is that so? As I see here: https://github.com/apache/nuttx/blob/master/include/assert.h#L122 assert defined exactly as DEBUGASSERT. There shouldn't b

Re: debugassert vs assert in apps

2024-01-03 Thread Gregory Nutt
On 1/3/2024 5:12 AM, Fotis Panagiotopoulos wrote: Hello everyone, I am glad that we all agree on this matter. We can handle this in the following steps: 1. Ensure that any new PRs and apps follow this convention. This is up to the reviewers, to enforce. 2. Get rid of all DEBUGASSERTs in apps.

Re: debugassert vs assert in apps

2024-01-03 Thread Fotis Panagiotopoulos
Hello everyone, I am glad that we all agree on this matter. We can handle this in the following steps: 1. Ensure that any new PRs and apps follow this convention. This is up to the reviewers, to enforce. 2. Get rid of all DEBUGASSERTs in apps. Unfortunately, a quick grep yielded 3410 results...

Re: debugassert vs assert in apps

2024-01-02 Thread Xiang Xiao
Here is the issue to track debug.h created before: https://github.com/apache/nuttx/issues/8986 On Wed, Jan 3, 2024 at 2:30 AM Gregory Nutt wrote: > > On Tue, Jan 2, 2024 at 11:16 AM Fotis Panagiotopoulos > > wrote: > >> DEBUGASSERT shall only be used for the kernel. > >> assert shall only be u

Re: debugassert vs assert in apps

2024-01-02 Thread Gregory Nutt
On Tue, Jan 2, 2024 at 11:16 AM Fotis Panagiotopoulos wrote: DEBUGASSERT shall only be used for the kernel. assert shall only be used for apps. Rationale: DEBUGASSERT is a custom macro that only exists in the NuttX world. As such it is best being used in NuttX-specific code. assert on the ot

Re: debugassert vs assert in apps

2024-01-02 Thread Nathan Hartman
This is an excellent summary! I suggest this should be documented somewhere in Documentation, with a more summarized version in the comment block of these macros. This way, the discussion and its conclusions will not be forgotten in the future!! Happy New Year, Nathan On Tue, Jan 2, 2024 at 11:16

Re: debugassert vs assert in apps

2024-01-02 Thread Fotis Panagiotopoulos
Hello everyone, and happy new year! After discussing this with Tim, I would like to present my opinion on this topic, in the hope we build better code conventions (or maybe understand better how apps are developed in Nuttx, as I don't use them often). So the idea is: DEBUGASSERT shall only be us

Re: debugassert vs assert in apps

2023-12-16 Thread Daniel Appiagyei
While we’re on this topic I would also like to encourage authors to put only one condition in their asserts instead of multiple. So, DEBUGASSERT(cond1) ; DEBUGASSERT (cond2); (…) Instead of DEBUGASSERT(cond1 && cond2 &&..). When an assertion happens and there’s multiple conditions then I don’t kn

debugassert vs assert in apps

2023-12-15 Thread Alan C. Assis
I think debugassert() is for finding BUGs during the development/testing phase. In the other hand assert() should be put in case where something really catastrofic is going to happen and cannot be avoid anyway. My personal opinion is that release code shouldn't have (or should have the minimum as

debugassert vs assert in apps

2023-12-14 Thread Tim Hardisty
Hi, I'm wondering if there is an "approved" usage of assert vs debugassert for files/apps in the nuttx-apps repo? My thinking is: * use debugassert if a function in apps would only fail if the calling code, probably (or possibly only) if other functions within apps, rather than an unkn