declaration

Global qualification in a class declarations class-head

那年仲夏 提交于 2020-01-10 04:25:20
问题 We found something similar to the following (don't ask ...): namespace N { struct A { struct B; }; } struct A { struct B; }; using namespace N; struct ::A::B {}; // <- point of interest Interestingly, this compiles fine with VS2005, icc 11.1 and Comeau (online), but fails with GCC: global qualification of class name is invalid before '{' token From C++03, Annex A, it seems to me like GCC is right: the class-head can consist of nested-name-specifier and identifier nested-name-specifier can't

VB 2010 'variable' is not declared. It may be inaccessible due to it's protection level

北慕城南 提交于 2020-01-10 04:23:20
问题 i'm sort of a n00b to VB and was wondering how to make a variable available across multiple Subs. It's just a test app to get familiar with VB. My Code: Public Class Sentences Private Sub SentenceBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SentenceBox.TextChanged If Me.Text = Trim(Sentence) Then MsgBox("Good job!") Main_Menu.Show() Me.Close() End If End Sub Private Sub ABCs_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase

Why is it possible to declare a variable without an initial value?

谁说我不能喝 提交于 2020-01-10 03:00:55
问题 I'm reading Gilles Dowek's Principles of Programming Languanges : He says that it's also possible to declare a variable without giving it an initial value and also that we must be careful not to use a variable which has been declared without an initial value and that has not been assigned a value. This produces an error. Note: The book's author mentions the possibility of declaring variables without an initial value on Java. So, why is this declaration of variables valid? When am I going to

Declaring arraz with dynamic content

别来无恙 提交于 2020-01-07 08:13:08
问题 Hello I want to make program wich will say how many big and short letters is in the word and such but run in to the problem I can't declare content of array dynamically. This is all C code. I tried this char something; scanf("%c",somethnig); char somethingmore[]=something; printf("%c",something[0]) but it wasn't possible to compile I also tried something like this char *something; scanf("%c",something); printf("%c",something[0]); wich was possible to compile but crushed when called array

Save XML file without Declaration - with specific address

微笑、不失礼 提交于 2020-01-07 04:00:43
问题 I am trying to find a way to save the XML file once edited, without including the declaration. But i need to be able to set an address. As i am saving over the original XML, and saving over a temp location one (duplicate of the original for javascript to access, as the original is in a local file). So i tried the $dom->saveXML($xml->documentElement); but comes out with some save errors. This is the php page that gets the form data and saves it to the currently loaded xml, then saves it and

How to declare global NodeJS variables within my ambient declaration file?

 ̄綄美尐妖づ 提交于 2020-01-07 03:11:21
问题 This is a follow-up question to this one. Given the answer on that question, let's say I have the following ambient declaration file: declare namespace Twilio { interface IDevice { ready(handler: Function): void; } let Device: IDevice; } This is working nicely on my application .ts files, Twilio.Device.ready is fully recognized. But I have my unit tests running with Jest and AFAIK, they run on a NodeJS environment. As an over simplified mock on my tests I have this (which are .ts files too):

Eclipse Package Declaration Work Around?

♀尐吖头ヾ 提交于 2020-01-05 07:45:25
问题 The team in which I'm working doesn't use eclipse and wants the src folder to be setup a certain way. I, on the other hand, am using eclipse. They would like the src folder to have, for example, the following structure: src/main/java/com/* However, they would like package declarations to only have com.* in them. If I go to project->properties and in the source tab remove the src folder as a source folder and then _only add the com.* folder as part of the source_ it will show com.* as a

Is there a difference between only <NSXMLParserDelegate>, only setDelegate method, or the use of both of them?

南楼画角 提交于 2020-01-05 05:42:08
问题 I noticed that when I do this : [myParser setDelegate:self]; it works :D (even if I didn't add the code in the header file ... you know, the <delegateStuff, delegateOtherStuff> in the interface declaration) When are you supposed to modify the header file to make your delegate work ? Is the setDelegate method enough to make it work ? Cheers for any help ;) Gauthier 回答1: In short, the <NSXMLParserDelegate> in your interface declaration is not required, it's there for error checking at compile

C++ Warning if re-declaring member variable in function

不羁的心 提交于 2020-01-05 03:32:11
问题 Given a structure such as below class A { int test; void f() { int test; } } I just had a curious case in which the code in f(), when referring to test, compiled under VS2010, correctly referred to the function local variable, however, when compiled under gcc, incorrectly referred to the member variable. Took me quite a while to track down. Anyway, question is, is there an option in gcc or VS to enable compiler warnings every time a member variable is re-declared in a local function scope?

can variables be set randomly when declaring them again?

五迷三道 提交于 2020-01-04 13:45:06
问题 In my method, I declare some variables, including int blockCount; . I call this method more than once. Using the Xcode debugger, I found out that after the second time the method was called, the value of blockCount was set to 364265, while it was set to 2, just a few milliseconds earlier. It's not a real problem, since I can just set it to 0 or any other number I'd like, but is it bad programming habit to have a certain variable declared over and over again? I'm quite new to programming, and