All Questions

761
votes
5answers
191231 views

What are the rules about using an underscore in a C++ identifier?

It's common in C++ to name member variables with some kind of prefix to denote the fact that they're member variables, rather than local variables or parameters. If you've come from an MFC background,...
395
votes
12answers
91351 views

Where do I find the current C or C++ standard documents?

For many questions the answer seems to be found in "the standard". However, where do we find that? Preferably online. Googling can sometimes feel futile, again especially for the C standards, since t...
228
votes
13answers
107547 views

Why aren't variable-length arrays part of the C++ standard?

I haven't used C very much in the last few years. When I read this question today I came across some C syntax which I wasn't familiar with. Apparently in C99 the following syntax is valid: void foo(...
56
votes
3answers
22363 views

When a function has a specific-size array parameter, why is it replaced with a pointer?

Given the following program, #include <iostream> using namespace std; void foo( char a[100] ) { cout << "foo() " << sizeof( a ) << endl; } int main() { char bar[100...
71
votes
7answers
25216 views

Are std::vector elements guaranteed to be contiguous?

My question is simple: are std::vector elements guaranteed to be contiguous? In order word, can I use the pointer to the first element of a std::vector as a C-array? If my memory serves me well, the...
395
votes
16answers
243386 views

Is there a W3C valid way to disable autocomplete in a HTML form?

When using the xhtml1-transitional.dtd doctype, collecting a credit card number with the following HTML <input type="text" id="cardNumber" name="cardNumber" autocomplete='off'/> will flag a w...
86
votes
3answers
17600 views

Are there machines, where sizeof(char) != 1, or at least CHAR_BIT > 8?

Are there machines (or compilers), where sizeof(char) != 1? Does C99 standard says that sizeof(char) on standard compliance implementation MUST be exactly 1? If it does, please, give me section numbe...
67
votes
6answers
11105 views

Order of evaluation in C++ function parameters

If we have three functions (foo, bar, and baz) that are composed like so... foo(bar(), baz()) Is there any guarantee by the C++ standard that bar will be evaluated before baz?
252
votes
11answers
130117 views

Are iframes considered 'bad practice'?

Somewhere along the line I picked up the notion that using iframes is 'bad practice'. Is this true? What are the pros/cons of using them?
63
votes
13answers
5727 views

Take the address of a one-past-the-end array element via subscript: legal by the C++ Standard or not?

I have seen it asserted several times now that the following code is not allowed by the C++ Standard: int array[5]; int *array_begin = &array[0]; int *array_end = &array[5]; Is &array[5...

Previous Next