GCC options for strictest C code? [duplicate]

I’d recommend using: -Wall -Wextra -std=c89 -pedantic -Wmissing-prototypes -Wstrict-prototypes \ -Wold-style-definition You should compile with -O as well as -g as some warnings are only available when the optimizer is used (actually, I usually use -O3 for spotting the problems). You might prefer -std=gnu89 as that disables fewer extensions in the libraries. OTOH, if you’re … Read more

Which (javascript) environments support ECMAscript 5 strict mode? (aka “use strict”)

Update: See my compatibility table. Original response: None as of now. Raphael Speyer was working on Mozilla implementation for Rhino during this summer, and afaik, their implementation is pretty close to completion. I know (based on info from ES-discuss list) that Microsoft is planning to include some of ES5 features into upcoming versions of IE … Read more

JavaScript: Can ECMAScript 5’s Strict Mode (“use strict”) be enabled using single quotes (‘use strict’)?

For you, without using a browser that supports strict mode: A Use Strict Directive is an ExpressionStatement in a Directive Prologue whose StringLiteral is either the exact character sequences “use strict” or ‘use strict’. A Use Strict Directive may not contain an EscapeSequence or LineContinuation.

In ECMAScript5, what’s the scope of “use strict”?

“use strict” applies only to function or program scope. So if you have fileA.js with “use strict” at the top, fileA.js executes in strict mode, and all functions defined in it will do the same when called. But fileB.js is a separate program, so the “use strict” from fileA.js doesn’t apply to it — and … Read more

Strict Violation using this keyword and revealing module pattern

JSHint has an option called validthis, which: […] suppresses warnings about possible strict violations when the code is running in strict mode and you use this in a non-constructor function […], when you are positive that your use of this is valid in strict mode. Use it in the function that JSHint is complaining about, … Read more

Does python have a “use strict;” and “use warnings;” like in perl?

To provide an answer that perhaps avoids a little of the commentary noise here, I’ll try another one. The two pragmata in your original question really expand to: use strict “vars”; use strict “refs”; use strict “subs”; use warnings; To answer each in turn: The effect of use strict “vars” is to cause a compile-time … Read more

Error message “Strict standards: Only variables should be passed by reference”

Consider the following code: error_reporting(E_STRICT); class test { function test_arr(&$a) { var_dump($a); } function get_arr() { return array(1, 2); } } $t = new test; $t->test_arr($t->get_arr()); This will generate the following output: Strict Standards: Only variables should be passed by reference in `test.php` on line 14 array(2) { [0]=> int(1) [1]=> int(2) } The reason? … Read more

Why is JSHINT complaining that this is a strict violation?

JSHint says “Possible strict violation” because you are using this inside something that, as far as it can tell, is not a method. In non-strict mode, calling gotoPage(5) would bind this to the global object (window in the browser). In strict mode, this would be undefined, and you would get in trouble. Presumably, you mean … Read more

PHP 5 disable strict standards error

Do you want to disable error reporting, or just prevent the user from seeing it? It’s usually a good idea to log errors, even on a production site. # in your PHP code: ini_set(‘display_errors’, ‘0’); # don’t show any errors… error_reporting(E_ALL | E_STRICT); # …but do log them They will be logged to your standard … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)