Skip to content

Sonarqube flagging on  #1

@peter-toft-greve

Description

@peter-toft-greve

https://github.com/eblot/newlib/blob/master/newlib/libc/string/strtok_r.c#L44 is being flagged by Sonarqube with these references

MISRA C:2004, 12.4 - The right-hand operand of a logical && or || operator shall not contain side effects.
MISRA C++:2008, 5-14-1 - The right hand operand of a logical && or || operator shall not contain side effects.
MISRA C:2012, 13.5 - The right hand operand of a logical && or || operator shall not contain persistent side effects
CERT, EXP02-C. - Be aware of the short-circuit behavior of the logical AND and OR operators

I see their point - the right hand side of the expression may or may not be run
if (s == NULL && (s = *lasts) == NULL)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions