Questions tagged [standards]

Standards are officially published or well agreed upon formats, procedures, or protocols. They allow individuals or organizations to collaborate by setting ground rules or boundaries. Standards often come with a set of preconditions or assumptions, which allow collaborators to take those conditions ...

832
votes
5answers
216k 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, ...
394
votes
12answers
108k 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 ...
268
votes
13answers
121k 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(...
60
votes
3answers
26k 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]...
75
votes
6answers
13k 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?
90
votes
7answers
32k 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 ...
88
votes
3answers
19k 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 ...
140
votes
12answers
62k views

Does JSON syntax allow duplicate keys in an object?

Is this valid json?{"a" : "x","a" : "y"}http://jsonlint.com/ says yes.http://www.json.org/ doesn't say anything about it being forbidden.But obviously it doesn't make much sense, ...
414
votes
17answers
255k 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 ...
69
votes
13answers
6k 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] ...
265
votes
11answers
145k views

Are iframes considered 'bad practice'? [closed]

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?
151
votes
8answers
166k views

Effects of the extern keyword on C functions

In C, I did not notice any effect of the extern keyword used before function declaration.At first, I thought that when defining extern int f(); in a single file forces you to implement it outside of ...
58
votes
6answers
5k views

Array placement-new requires unspecified overhead in the buffer?

5.3.4 [expr.new] of the C++11 Feb draft gives the example: new(2,f) T[5] results in a call of operator new[](sizeof(T)*5+y,2,f).Here, x and y are non-negative unspecified values representing ...
7
votes
3answers
11k views

Strict Standards: mysqli_next_result() error with mysqli_multi_query

I have tried using multi_query but I keep getting a strict Standards message popping up. $querystring="INSERT INTO responses VALUES('1', '2', '3', '4'); INSERT INTO responses VALUES('1', '2'...
85
votes
8answers
47k views

Is “argv[0]=name-of-executable” an accepted standard or just a common convention?

When passing argument to main() in a C or C++ application, will argv[0] always be the name of the executable? Or is this just a common convention and not guaranteed to be true 100% of the time?
33
votes
2answers
6k views

Are compound statements (blocks) surrounded by parens expressions in ANSI C?

Browsing the Linux kernel sources I found some piece of code where a block of statements surrounded by parenthesis is treated as a expression a la lisp (or ML), that is, an expression which value is ...
17
votes
2answers
11k views

Why can't I have a numeric value as the ID of an element?

Working on a project, nearly finished and just tidying up the HTML and I find out that you're not really allowed to have an ID that is just a number-< a> attribute "id" has invalid value "567" ...
49
votes
8answers
58k views

Difference between void main and int main? [duplicate]

Does it matter which way I declare my C++ programs?
883
votes
1answer
176k views

What are the new features in C++17?

C++17 is now feature complete, so unlikely to experience large changes. Hundreds of proposals were put forward for C++17.Which of those features were added to C++ in C++17?When using a C++ ...
192
votes
14answers
154k views

How is the default submit button on an HTML form determined?

If a form is submitted but not by any specific button, such asby pressing Enterusing HTMLFormElement.submit() in JShow is a browser supposed to determine which of multiple submit buttons, if any, ...
91
votes
9answers
18k views

Non-Standard Attributes on HTML Tags. Good Thing? Bad Thing? Your Thoughts?

HTML (or maybe just XHTML?) is relatively strict when it comes to non-standard attributes on tags. If they aren't part of the spec, then your code is considered non-compliant.Non-standard attributes ...
59
votes
5answers
18k views

Do you quote HTML5 attributes? [closed]

Attribute quotes are optional in HTML5.What are the pros/cons to quoting them?id=example <!--quotes optional-->href=http://example.com <!--quotes optional-->...
165
votes
8answers
99k views

Can (domain name) subdomains have an underscore “_” in it?

Can subdomains (domain names) have underscore _ in them?
15
votes
4answers
5k views

One-dimensional access to a multidimensional array: is it well-defined behaviour?

I imagine we all agree that it is considered idiomatic C to access a true multidimensional array by dereferencing a (possibly offset) pointer to its first element in a one-dimensional fashion, e.g.:...
189
votes
7answers
18k views

Why are Standard iterator ranges [begin, end) instead of [begin, end]?

Why does the Standard define end() as one past the end, instead of at the actual end?
25
votes
6answers
5k views

Are compilers allowed to eliminate infinite loops?

Can optimizing compiler delete infinite loops, which does not changes any data, likewhile(1) /* noop */;From analyzing a data flow graph compiler can derive, that such loop is "dead code" ...
19
votes
4answers
6k views

Multiple assignment in javascript? What does [a,b,c]=[1, 2, 3]; mean?

For a project a developer sent us a .js file with code similar to this:var myList=[1,2,3];var a,b,c;[a,b,c]=myList;It works in Opera 10.30, Firefox 3.6.x but it's not ok for Opera 10.60 and ...
172
votes
5answers
84k views

What's the difference between __PRETTY_FUNCTION__, __FUNCTION__, __func__?

What's the difference between __PRETTY_FUNCTION__, __FUNCTION__, __func__, and where are they documented? How do I decide which one to use?
76
votes
6answers
54k views

How to determine the version of the C++ standard used by the compiler?

How do you determine what version of the C++ standard is implemented by your compiler? As far as I know, below are the standards I've known:C++03C++98
209
votes
9answers
123k views

Is an anchor tag without the href attribute safe?

Is it okay to use an anchor tag without including the href attribute, and instead using a JavaScript click event handler? So I would omit the href completely, not even have it empty (href="http://stackoverflow.com.mevn.net/").

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,