On Tue, Mar 3, 2015 at 12:56 AM, Anthony J. Bentley anth...@cathet.us wrote:
Evan Gates writes:
Declaring variables at the top of a block, as opposed to top of the
function has a few uses, but the most useful (in my limited
experience) is combining it with C99's variable length arrays to
On Mon, Mar 2, 2015 at 3:56 PM, Anthony J. Bentley anth...@cathet.us wrote:
VLAs are a fundamentally broken feature because they do not allow any
error checking. alloca() is the same.
--
Anthony J. Bentley
But when do you ever do error checking of stack size? Is recursion a
alloca() isn't even standard C, that's some black voodoo GNU sorcery
right there.
From alloca(2):
There is evedence that the alloca() function appeared in 32V,
PWB, PWD.2, 3BSD and 4BSD. There is a man page for it in
4.3BSD.
It was common before GNU, and it was not
It was my understanding that Do not mix declarations and code meant
stick to ANSI C declarations. ANSI C allows declarations of variables
only at the top of blocks, but allows them in any block so they aren't
relegated to the top of the function. It was pointed out to me that
Do not mix
This came up recently in talks about style in sbase due to my
misunderstanding of Do not mix declarations and code and subsequent
addition of the line All variable declarations at top of block in
the style guide.
It was my understanding that Do not mix declarations and code meant
stick to ANSI C
Evan Gates wrote:
Thoughts?
Heyho,
a suckless piece of code, where this is used would be the manage() function of
tabbed.c. I don't mind it to declare variables in inner blocks, so it is clear
to the reader that this variable is only intended to be used inside this block
and not only the mighty
On Mon, Mar 2, 2015 at 3:56 PM, Anthony J. Bentley anth...@cathet.us wrote:
VLAs are a fundamentally broken feature because they do not allow any
error checking. alloca() is the same.
--
Anthony J. Bentley
But when do you ever do error checking of stack size? Is recursion a
fundamentally
Evan Gates writes:
Declaring variables at the top of a block, as opposed to top of the
function has a few uses, but the most useful (in my limited
experience) is combining it with C99's variable length arrays to
create buffers without calls to malloc/free. For example:
while ((d =