declaration

Can't understand the declaration #3 in the Example of [basic.link]/6 C++14

泄露秘密 提交于 2019-11-28 02:49:57
问题 [basic.link]/6 The name of a function declared in block scope and the name of a variable declared by a block scope extern declaration have linkage. If there is a visible declaration of an entity with linkage having the same name and type, ignoring entities declared outside the innermost enclosing namespace scope, the block scope declaration declares that same entity and receives the linkage of the previous declaration. If there is more than one such matching entity, the program is ill-formed.

Declaring a useless local variable

[亡魂溺海] 提交于 2019-11-28 02:42:27
问题 So this is an odd one, I know the code itself is fairly useless, but what I'm wondering why I get the error: I was writing some code, I had written this: if(scan.hasNextInt()) int row = scan.nextInt(); Wasn't thinking about variable scope at the time, obviously this is useless because I can't use row past the if anyway. What I don't get is why I got the error I did: > javac hw.java hw.java:25: '.class' expected int row = scan.nextInt(); ^ hw.java:25: not a statement int row = scan.nextInt();

Synthesize error “Missing Context for Property Implementation Declaration”

邮差的信 提交于 2019-11-28 02:37:08
问题 Anyone have any ideas? When I try to synthesize a property I have declared in the .h file its not letting me synthesize it. Any ideas? Thanks! 回答1: This can happen when you attempt to synthesize a property outside of the scope of your class' implementation. Incorrect: @synthesize yourProperty; @implementation YourClass @end Correct: @implementation YourClass @synthesize yourProperty; @end 回答2: It often happen when you use #import ,and does not on the top of file. 来源: https://stackoverflow.com

Declaring variable type based on a column type

我只是一个虾纸丫 提交于 2019-11-28 02:28:45
问题 In Oracle's PL-SQL, you can declare a variable and define its type based on a table column: declare var1 table.column%TYPE; Is it possible to do something similar in MS SQL Server? 回答1: No you can't do this. The closest equivalent is User-Defined Data Types. This will give you a layer of abstraction that may help, but it is not the same as deriving a type from a column. 回答2: It may skirt the real issue, but you can "cheat" a little bit by Select * INTO #tmp From MyTable Where 1 = 0 Will

String vs string [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 02:26:15
问题 This question already has answers here : What is the difference between String and string in C#? (65 answers) Closed last month . In C# there are String objects and string objects. What is the difference between the two? What are the best practices regarding which to use? 回答1: There is no difference. string (lower case) is just an alias for System.String. 回答2: No difference. System.String is strictly identical to string . Common C# coding guidelines indicates that you should use the keyword

Regex for variable declaration and initialization in c#

你说的曾经没有我的故事 提交于 2019-11-28 02:09:17
问题 I want to write a RegEx to pull out all the variable values and their names from the variable declaration statement. Say i have int i,k = 10,l=0 i want to write a regex something like int\s^,?|(^,?)* but this will also accept k = 10 i.e. (without int preceding it) Basically idea is If string starts with int then get the variable list seperated by , i know to extract csv values, but here my string has some initial value as well. How can i resolve it? 回答1: Start thinking about the structure of

Class declaration in same scope as using declaration compiles in GCC but not MSVS

流过昼夜 提交于 2019-11-28 01:07:39
问题 Is the following program well-formed according to the c++ standard? namespace X { class A; } namespace Y { using X::A; class A {}; } int main() {} I'm getting different results with different compilers: gcc compiles it without errors. visual c++ gives error C2888: 'X::A': symbol cannot be defined within namespace 'Y' I don't find any rule in the c++ standard that my program violates. If the program is well-formed, why does visual studio give an error? If the program is not well-formed, what

C multiple single line declarations

試著忘記壹切 提交于 2019-11-27 21:06:30
What happens when I declare say multiple variables on a single line? e.g. int x, y, z; All are ints. The question is what are y and z in the following statement? int* x, y, z; Are they all int pointers? Only x is a pointer to int; y and z are regular ints. This is one aspect of C declaration syntax that trips some people up. C uses the concept of a declarator , which introduces the name of the thing being declared along with additional type information not provided by the type specifier . In the declaration int* x, y, z; the declarators are *x , y , and z (it's an accident of C syntax that you

Difference between pointer to pointer and pointer to array?

空扰寡人 提交于 2019-11-27 20:42:21
Given that the name of an array is actually a pointer to the first element of an array, the following code: #include <stdio.h> int main(void) { int a[3] = {0, 1, 2}; int *p; p = a; printf("%d\n", p[1]); return 0; } prints 1 , as expected. Now, given that I can create a pointer that points to a pointer, I wrote the following: #include <stdio.h> int main(void) { int *p0; int **p1; int (*p2)[3]; int a[3] = {0, 1, 2}; p0 = a; p1 = &a; p2 = &a; printf("p0[1] = %d\n(*p1)[1] = %d\n(*p2)[1] = %d\n", p0[1], (*p1)[1], (*p2)[1]); return 0; } I expected it to compile and print p0[1] = 1 (*p1)[1] = 1 (*p2)

Eclipse Open declaration in Java project

↘锁芯ラ 提交于 2019-11-27 20:38:24
问题 In an Eclipse SVN project I have a problem; when I tried to open a declaration of one class, I got this error: Problems opening an editor Reason : projectname does not exist. Also refactoring does not work. I have searched the web and tried all found solutions but nothing helped. I have downloaded different Eclipse and Java versions and switched to a clean workspace but I still have the problem. How can I solve my problem or which solution can I try? 回答1: Right Click on the project ->