#WHAT THE HELL?

19 messages · Page 1 of 1 (latest)

quaint kiteBOT
#

When your question is answered use !solved or the button below to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

frosty pelican
#

!sc

quaint kiteBOT
# frosty pelican !sc
dnd, Herald of Bald Heads
Please Do Not Send Screenshots or Photos!

They're hard to read and prevent copying and pasting.

cedar hull
#

this usually means that your program crashed

#

also just an fyi

quaint kiteBOT
#
What Is a VLA, and Why Is It "Bad"?

A Variable Length Array (VLA) is an array where the size is not constant and depends on a variable.

Example
int size = rand();
int vla[size]; // VLA of type int[size]
int not_vla[10]; // regular array of type int[10]
constexpr int size = 10;
int arr[size]; // also not a VLA, of type int[10]
Why Are VLAs "Bad"?

VLAs have poor compiler support and can lead to unsafe code. The core issue with VLAs is that the compiler doesn't know the size of the stack frame. Without warning flags like -Wvla, it can be easy to create a VLA by accident, even in C++ with some compilers.

Compiler Support

:white_check_mark: available since C99
:no_entry: not available in C++ at all
:no_entry: was never supported by MSVC
:warning: optional feature since C11
:warning: supported as non-standard extension by GCC and clang

frosty pelican
#

make sure you initialize your integers.

cedar hull
#

okay, not n but the program stops before the read happens

#

oh

#

T

#

yeah you didnt initialize T ...

cloud helm
#

oh yea

#

tysm

quaint kiteBOT
# quaint kite

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

#

@cloud helm

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.

#

@cloud helm Has your question been resolved? If so, type !solved :)

cloud helm
#

!solved

quaint kiteBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity