declaration

what is the difference between function declaration and signature?

In C or C++ what is the difference between function declaration and function signature? I know something of function declaration but function signature is totally new to me. What is the point of having the concept of function signature? What are the two concepts used for actually? Thanks! ...

Why can't i set a member variable of an interface class as follows.

So i have a interface class class interfaceClass { public: virtual void func1( void ) = 0; virtual void func2( void ) = 0; protected: int m_interfaceVar; } and a class that inherits from it. Why can't i set the member variable of the interface class as follows. class inhertitedClass : public interfaceClass { inher...

How to get method name from VariableDeclarationStatement

hi, i have a variable of type VariableDeclarationStatement. I want to get the name of the method from this variable . How can i do that?Help ...

C# - Declaration of types within a namespace

Hi folks, what could be a possible use of declaring types within a namespace but not in a class. For ex: namespace Test { public delegate void Ispossible(); } This is valid & does not generate any compilation errors but i can't think of why we would declare it this way as opposed to inside a class. ...

Why does this separate definition cause an error?

Solution: This is an interesting problem, because sometimes we have no choice but to declare an explicitly qualified name. std::string convert(); namespace tools { class Numeric { // ... // parsed as: "friend std::string::convert ();" // (actual name is missing!). friend std::string ::convert(); }; } In that c...

How to declare a pointer to a variable as a parameter of a function in C++?

I have a function that takes a const D3DVECTOR3 *pos, but I have no reason to declare this beforehand. The most logical solution to me was using new: Function( //other parameters, new D3DXVECTOR3(x, y, 0)); but I don't know how I would go about deleting it, beign intitialized in a function. My next thought was to use the & o...

Should External Routine Be Declared Always in Fortran?

In my Fortran code I made the following call to the dnrm2 routine: d = dnrm2(n, ax, 1) Just a simple call that would return me a double precision result. The question is, should I declare the function at the start of my script? I found that if I don't declare it, when I compile the code in 32 bit Windows, then the result is correct. ...

C/C++ definitions of functions

Yesterday, I have been watching discussion here, about compilers and linkers. It was about C library function definitions. I have never thought of that, so it inspired me to do some searching, but I cannot find exactly what I want. I wonder, what is the smallest syntax you need to add into your source code to enable just printf() functio...

ANTLR C grammar, optional init_declarator_list?

Hello, In the ANSI C grammar for ANTLR v3 ( http://antlr.org/grammar/1153358328744/C.g ), how can init_declarator_list be optional in rule declaration ? Instead of: | declaration_specifiers init_declarator_list? ';' -I would say: | declaration_specifiers init_declarator_list ';' What part of the C standard allows statements like...

Why is there no * in front of delegate declaration ?

Hey guys, I just noticed there is no * in front of the declaration for a delegate ... I did something like this : @protocol NavBarHiddenDelegate; @interface AsyncImageView : UIView { NSURLConnection* connection; NSMutableData* data; UIActivityIndicatorView *indicator; id <NavBarHiddenDelegate> delegate; } @prope...

C++ Variable declarable in function body, but not class member?

I want to create a C++ class with the following type: It can be declared inside of a function. It can be declared inside of a member function. It can not be declared as a class member. The use of this: think "Root" objects for a GC. Is this possible in C++? In particular, I'm using g++. Willing to switch to clang. Either templates o...

C++: Declaration of template class member specialization

When I specialize a (static) member function/constant in a template class, I'm confused as to where the declaration is meant to go. Here's an example of what I what to do - yoinked directly from IBM's reference on template specialization: ===IBM Member Specialization Example=== template<class T> class X { public: static T v; st...

C# newbie problem part 2 - declaring class and method

[AcceptVerbs(HttpVerbs.Post)] public ActionResult Upload(Photo photo) { foreach (string file in Request.Files) { var path = "~/Uploads/Photos/"; HttpPostedFileBase posted = (HttpPostedFileBase)Request.Files[file]; if (posted.ContentLength > 0) { photo.Date = DateTime.Now; ...

Conflicting return types

I am doing a recursive program and I am getting an error about conflicting types: void* buddyMalloc(int req_size) { // Do something here return buddy_findout(original_index,req_size); // This is the recursive call } void *buddy_findout(int current_index,int req_size) { char *selected = NULL; if(front!=NULL) { ...

How can c let a function declaration with any parameter type ?

I forgot to write void parameter but it works the i put void it gives error it lets this: print(int size,int table[size][size]){ int i,j; printf("-------TABLE-------\n"); for(i = 0;i<size;i++){ for(j = 0;j<size;j++){ if(table[i][j]==EMPTY) printf(". "); else printf("* "); } printf("\n"); ...

Java declarations (ordering)

In Java, what's generally the most accepted way to organize a class in terms of the order in which declared data members and methods should be listed in the class file, keeping in mind the following and anything else you can think of for each one: its visibility whether it's a constructor, method, or member if it's a method, does it ov...

correct format for function prototype

Hi, I'm writing to a text file using the following declaration: void create_out_file(char file_name[],long double *z1){ FILE *out; int i; if((out = fopen(file_name, "w+")) == NULL){ fprintf(stderr, "***> Open error on output file %s", file_name); exit(-1); } for(i = 0; i < ARRAY_SIZE; i++) fp...

variable names in function definition, call and declaration

Hi, I see C books that use the same variable names in the function definition, calling function and declaration. Others use the same variable names in the calling function and in the declaration/prototype but a different one in the definition as in: void blabla(int something); //prototype blabla(something) // calling function inside m...

Encoding in XML declaration python

I have created an XML file using python. But the XML declaration has only version info. How can I include encoding with XML declaration like: <?xml version="1.0" encoding="UTF-8"?> ...

Is there a way to know if a variable has been declared in C ?

hi, I'm implementing some code generators, i would like to know if there's any way in C, if a variable has already been declared ? I was trying to find something using the preprocessor but without any success... thanks. ...