Questions tagged [standards-compliance]

400 questions
10074
votes
28 answers

What is the '-->' operator in C/C++?

After reading Hidden Features and Dark Corners of C++/STL on comp.lang.c++.moderated, I was completely surprised that the following snippet compiled and worked in both Visual Studio 2008 and G++ 4.4. I would assume this is also valid C since it…
GManNickG
  • 494,350
  • 52
  • 494
  • 543
389
votes
15 answers

Is it valid to have an HTML form inside another HTML form?

Is it valid HTML to have the following:
So when you submit "b" you only get the fields within…
FlyByQuestionGuy
367
votes
19 answers

Can an HTML element have multiple ids?

I understand that an id must be unique within an HTML/XHTML page. For a given element, can I assign multiple ids to it?
I realize I have an easy solution with simply using a class. I'm just curious about…
webmat
  • 58,466
  • 12
  • 54
  • 59
287
votes
8 answers

Do the JSON keys have to be surrounded by quotes?

Example: Is the following code valid against the JSON Spec? { precision: "zip" } Or should I always use the following syntax? (And if so, why?) { "precision": "zip" } I haven't really found something about this in the JSON specifications.…
christianvuerings
  • 22,500
  • 4
  • 23
  • 19
276
votes
6 answers

C++ new int[0] -- will it allocate memory?

A simple test app: cout << new int[0] << endl; outputs: 0x876c0b8 So it looks like it works. What does the standard say about this? Is it always legal to "allocate" empty block of memory?
anon
150
votes
1 answer

Does a dot have to be escaped in a character class (square brackets) of a regular expression?

A dot . in a regular expression matches any single character. In order for regex to match a dot, the dot has to be escaped: \. It has been pointed out to me that inside square brackets [] a dot does not have to be escaped. For example, the…
Dariusz
  • 21,561
  • 9
  • 74
  • 114
146
votes
2 answers

Does constexpr imply inline?

Consider the following inlined function : // Inline specifier version #include #include inline int f(const int x); inline int f(const int x) { return 2*x; } int main(int argc, char* argv[]) { return…
Vincent
  • 57,703
  • 61
  • 205
  • 388
145
votes
3 answers

What is going on with 'gets(stdin)' on the site coderbyte?

Coderbyte is an online coding challenge site (I found it just 2 minutes ago). The first C++ challenge you are greeted with has a C++ skeleton you need to modify: #include #include using namespace std; int FirstFactorial(int…
bolov
  • 72,283
  • 15
  • 145
  • 224
136
votes
12 answers

Is main() really start of a C++ program?

The section $3.6.1/1 from the C++ Standard reads, A program shall contain a global function called main, which is the designated start of the program. Now consider this code, int square(int i) { return i*i; } int user_main() { for ( int i = 0…
Nawaz
  • 353,942
  • 115
  • 666
  • 851
134
votes
10 answers

RegEx to parse or validate Base64 data

Is it possible to use a RegEx to validate, or sanitize Base64 data? That's the simple question, but the factors that drive this question are what make it difficult. I have a Base64 decoder that can not fully rely on the input data to follow the RFC…
LarryF
  • 4,925
  • 4
  • 32
  • 40
129
votes
2 answers

When does invoking a member function on a null instance result in undefined behavior?

Consider the following code: #include struct foo { // (a): void bar() { std::cout << "gman was here" << std::endl; } // (b): void baz() { x = 5; } int x; }; int main() { foo* f = 0; f->bar(); // (a) …
123
votes
6 answers

Clean way to launch the web browser from shell script?

In a bash script, I need to launch the user web browser. There seems to be many ways of doing this: $BROWSER xdg-open gnome-open on GNOME www-browser x-www-browser ... Is there a more-standard-than-the-others way to do this that would work on most…
nicoulaj
  • 3,463
  • 4
  • 27
  • 32
117
votes
5 answers

Declaration of Methods should be Compatible with Parent Methods in PHP

Strict Standards: Declaration of childClass::customMethod() should be compatible with that of parentClass::customMethod() What are possible causes of this error in PHP? Where can I find information about what it means to be compatible?
waiwai933
  • 14,133
  • 21
  • 62
  • 86
72
votes
6 answers

Why does MySQL allow "group by" queries WITHOUT aggregate functions?

Surprise -- this is a perfectly valid query in MySQL: select X, Y from someTable group by X If you tried this query in Oracle or SQL Server, you’d get the natural error message: Column 'Y' is invalid in the select list because it is not contained…
Aaron Fi
  • 10,116
  • 13
  • 66
  • 91
57
votes
3 answers

Java reflection: Is the order of class fields and methods standardized?

Using reflection on Java classes to access all field, methods, and so on: Is there a standardized order of these elements (which is specified in some standard)? Of course, I could check it empirically, but I need to know if it's always the…
ivan_ivanovich_ivanoff
  • 19,113
  • 27
  • 81
  • 100
1
2 3
26 27