Analyze Warning DDTTYLogger.m VLA Zero Size #40

Closed
neilt opened this Issue Jun 8, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@neilt

neilt commented Jun 8, 2012

Not sure if this is a problem or not, but I try to keep zero analyze issues in my code. So this sticks out.

.../Lumberjack/DDTTYLogger.m:1215:3: warning: Declared variable-length array (VLA) has zero size
                char msgStack[useStack ? (msgLen + 1) : 0];
                ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assuming 'isaTTY' is not equal to 0
Assuming 'logMsg' is non-nil
Declared variable-length array (VLA) has zero size

@robbiehanson

This comment has been minimized.

Show comment Hide comment
@robbiehanson

robbiehanson Jun 8, 2012

Contributor

The VLA has zero size when the code doesn't use it. Didn't know this would generate an analyzer warning. We could simply change the '0' to a '1' to silence it.

On Friday, June 8, 2012 at 5:37 AM, neilt wrote:

Not sure if this is a problem or not, but I try to keep zero analyze issues in my code. So this sticks out.

.../Lumberjack/DDTTYLogger.m:1215:3: warning: Declared variable-length array (VLA) has zero size
char msgStack[useStack ? (msgLen + 1) : 0];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assuming 'isaTTY' is not equal to 0
Assuming 'logMsg' is non-nil
Declared variable-length array (VLA) has zero size


Reply to this email directly or view it on GitHub:
robbiehanson#40

Contributor

robbiehanson commented Jun 8, 2012

The VLA has zero size when the code doesn't use it. Didn't know this would generate an analyzer warning. We could simply change the '0' to a '1' to silence it.

On Friday, June 8, 2012 at 5:37 AM, neilt wrote:

Not sure if this is a problem or not, but I try to keep zero analyze issues in my code. So this sticks out.

.../Lumberjack/DDTTYLogger.m:1215:3: warning: Declared variable-length array (VLA) has zero size
char msgStack[useStack ? (msgLen + 1) : 0];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assuming 'isaTTY' is not equal to 0
Assuming 'logMsg' is non-nil
Declared variable-length array (VLA) has zero size


Reply to this email directly or view it on GitHub:
robbiehanson#40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment