using-directives

Should a using command issue a warning when using a reserved identifier?

纵然是瞬间 提交于 2019-12-08 15:46:29
问题 When using the line using std::literals::chrono_literals::operator""s; in g++ 6.3.0, the compiler issues a warning stating: warning: literal operator suffixes not preceded by '_' are reserved for future standardization using std::literals::chrono_literals::operator""s; A similar warning is also issued in MSVS. However, clang 3.8.0 issues no such warning. Since operator""s is defined by the standard for the chrono library shouldn't this not issue a warning since we are just importing the name

What is the namespace 'Standard'?

╄→尐↘猪︶ㄣ 提交于 2019-12-08 15:29:23
问题 When I try to write a new using clause, I notice that Intellisense has, in its list, a namespace called Standard . However, this seems to have no members on closer inspection. What is this namespace? 回答1: There is a namespace in the PresentationFramework assembly called "Standard". All of its types are internal though, so you can't see any of the types. However, you can still use the namespace. The namespace seems to have appeared in the 4.5 reference assembly, it doesn't appear in the 4.0

Why is “using namespace std;” considered bad practice?

和自甴很熟 提交于 2019-12-06 06:08:58
I've been told by others that writing using namespace std; in code is wrong, and that I should use std::cout and std::cin directly instead. Why is using namespace std; considered a bad practice? Is it inefficient or does it risk declaring ambiguous variables (variables that share the same name as a function in std namespace)? Does it impact performance? Greg Hewgill This is not related to performance at all. But consider this: you are using two libraries called Foo and Bar: using namespace foo; using namespace bar; Everything works fine, and you can call Blah() from Foo and Quux() from Bar

C# using namespace directive in nested namespaces

两盒软妹~` 提交于 2019-12-06 03:49:24
Right, I've usually used 'using' directives as follows using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AwesomeLib { //awesome award winning class declarations making use of Linq } i've recently seen examples of such as using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AwesomeLib { //awesome award winning class declarations making use of Linq namespace DataLibrary { using System.Data; //Data access layers and whatnot } } Granted, i understand that i can put USING inside of my namespace declaration.

Javascript: besides “use strict”, which other “use” directives are there?

我怕爱的太早我们不能终老 提交于 2019-12-06 02:36:55
问题 Besides use strict , which other use directives are there? 回答1: Some more examples that can be in the “directive prologue” (a section potentially usable by JavaScript engines): 'use strict'; 'use asm'; Mozilla's asm.js is a subset of the language, geared towards crunching numbers. 'use stricter'; Google's SoundScript. For fast OOP Has also some modes like: 'use stricter+types'; http://www.2ality.com/2015/02/soundscript.html 'use babel'; Used in Atom.io. (Was previously: 'use 6to5'; ) A tweet

Twitterizer 2 and C# - Namespace could not be found

我与影子孤独终老i 提交于 2019-12-05 17:16:12
问题 I have a silly problem with Twitterizer2 and probably me :) . I add the reference twitterizer 2.3.1 from my downloads directory along with the newtonsoft one by right clicking on references and browsing to find them. I then add using Twitterizer; lo and behold all my squiggly red underlines go away on all this sort of code: OAuthTokens tokens = new OAuthTokens(); when I go to run it(with debug), I get an error: Error 2 The type or namespace name 'Twitterizer' could not be found (are you

Have ReSharper keep 'using System;' when optimizing usings

会有一股神秘感。 提交于 2019-12-05 13:28:41
问题 I was wondering if there is some option to keep ReSharper from removing just the using System; directive? Perhaps this is configurable somewhere? Also, is there a way to have ReSharper sort the remaining directives just as Visual Studio 2008 does it (alphabetically, I think)? Thanks. 回答1: Yes, there is such an option: ReSharper->Languages->C#->Namespace Imports. You can add namespaces,that should not be removed, as well as namespaces, that should always be imported. 回答2: Yes, in the options (

Javascript: besides “use strict”, which other “use” directives are there?

那年仲夏 提交于 2019-12-04 08:10:16
Besides use strict , which other use directives are there? GitaarLAB Some more examples that can be in the “directive prologue” (a section potentially usable by JavaScript engines): 'use strict'; 'use asm'; Mozilla's asm.js is a subset of the language, geared towards crunching numbers. 'use stricter'; Google's SoundScript. For fast OOP Has also some modes like: 'use stricter+types'; http://www.2ality.com/2015/02/soundscript.html 'use babel'; Used in Atom.io . (Was previously: 'use 6to5'; ) A tweet by Jeremy Ashkenas suggests some further use of + and - prefixes in the same 'use ...'; string (

In C#, is it more performant to use fully qualified names vs the 'using' directive?

橙三吉。 提交于 2019-12-04 02:59:48
问题 In C#, when you add a using directive for a namespace, it gives you access to all the types in that specific namespace. However, if the namespace has a lot of types and I only need one particular one, I often just use the fully qualified name thinking that I don't want to make available any unnecessary classes I know I am not going to use (especially if there are a lot of them in that namespace) for performance reasons . I was thinking that there has to be some impact to performance (no

How to prevent ReSharper from shortening namespaces when adding using directives?

落花浮王杯 提交于 2019-12-04 02:33:24
When I use ReSharper to add a using directive (using Alt+Enter) it removes "unnecessary" parts of the namespace. I prefer using the full namespace which is also the behavior of Visual Studio. Example: namespace MyCompany.MyTool.Data { // This is what ReSharper gives me: using Core; // This is what I want: using MyCompany.MyTool.Core; // ... } Which setting do I have to change in ReSharper 4.5 so it uses the full namespace? I don't have ReSharper 4.5 installed at the moment, but in 5.0 there's an option at the Namespace Imports pane called Prefer fully qualified using name at nested scope . It