declaration

Defining a large array of size larger than a unsigned int limit.

Hello, I need to define an array statically (in a *.h) file of size 12884901888 like. unsigned char sram[12884901888]; //All of my code is C. Above declaration gives error and does not work. Because constants used in array declarations are unsigned int. But the constant i need to use (12884901888) is larger than the unsigned int lim...

When do I define objective-c methods?

I'm learning Objective-C, and have a C/C++ background. In object-oriented C++, you always need to declare your method before you define (implement) it, even if it is declared in the parent class. In procedural-style C, IIRC, you can get away with just defining a function so long as it is only called from something else in the same ...

Declaring Variables

Hi, Say you have a variable called hotelPropertyNumber. The contents will always be a number but normally be used as a string. Would there be anything "wrong" with declaring it as a string so that you don't have to continually convert it to a string....or is that a bad programming habit? Thanks. ...

F# Private Static Methods

How do i define a private static method in a class in f#? when i try to attach a private modifier it complains. ...

What happens when we dont specify datatype of arguments in a function and pass parameters to it while calling it?

Look at the following program. int main() { char a=65, ch ='c'; printit(a,ch); } printit(a,ch) { printf("a=%d ch=%c",a,ch); } Even if the data type of the arguments is not specified in the function 'printit()', the result is shown on printf. I see correct answer when i compile it with gcc and run it.Why? Is it not neces...

Initializing 2D int array

Hello. I got this code from a c++ book, and I cannot figure out how the initialization works. From what I can see, there is an outer for loop cycling trough the rows, and the inner loop cycling trough the column. But its is the assignment of the values into the array that I do not understand. #include <iostream> using namespace std; i...

Javascript setting variables and object and proper syntax (debug console)

So I am trying to invoke methods on a page and I know the values that I want to put inside the methods but I can't seem to get the syntax to work. I feel so, well.. lamerized. Ok so here is the javascript method on the page function ReturnValue (sValue, sText) { window.focus(); var oForm = document.EditForm; switch (s...

Type Declarations in Fortran

I suppose the type of Y below is REAL. SUBROUTINE F(X, Y) C IMPLICIT NONE REAL :: X, Y C REAL :: A, B C REAL, PARAMETER :: C = 3.14E0 C X = Y + 2 * SIN(Y) END But what is it's type here? SUBROUTINE F(X, Y) C IMPLICIT NONE REAL X, Y C REAL :: A, B C REA...

Help with understanding C# code and porting to Objective-C

Ok, I have this prototype that was written by someone else in C# and I'm trying to put it into Objective-C. Now, I haven't had any formal experience with C# yet, so I don't know everything about it yet. I understand what the first three variables are, but I'm running into problems with what the fourth and fifth lines (c_data) are doing. ...

ASP VBSCRIPT variable declaration issue

First of all, I got a question in .asp page Class clsTesting Function hash_call ( methodName,nvpStr ) ..... Set SESSION("nvpReqArray")= deformatNVP( nvpStrComplete ) ..... End Function end class When I perform call to this function, once reach the Set SESSION("nv line it say error: Microsoft VBScript runtime (0x800A01A8) Object ...

Declaring function parameters after function name

int func(x) int x; { ............. What is this kind of declaration called? When is it valid/invalid including C or C++, certain standard revisions and compilers? ...

Is it possible to release a variable in c#?

I'm just curious... Is it possible to release a variable in c#? What I mean is, can you do something like this: ... string x = "billy bob"; //release variable x somehow string x = "some other string"; //release variable x somehow int x = 329; ... ... so basically you are declaring the variable multiple times in the same scope. ...

Declaring variables inside a switch statement

I saw a few answers to this issue, and I get it — you can't declare and assign variables inside a switch. But I'm wondering if the following is correct at throwing an "error: expected expression before 'int' switch (i) { case 0: int j = 1; break; } Why would putting an NSLog before it result in no errors? switch ...

C++ method declaration question

I have some code in Image.cpp: Image::Image( int width, int height, int depth ) : m_sFileName(0) { ... } and in Image.h: class Image: public DrawAble, public RenderAble { ... private : std::string *m_sFileName; }; My question is: what is happening with m_sFilename in the first line? I guess it is set to NULL...

Cannot refer to a non-final variable inside an inner class defined in a different method

Edited: I need to change the values of several variables as they run several times thorugh a timer. I need to keep updating the values with every iteration through the timer. I cannot set the values to final as that will prevent me from updating the values however I am getting the error I describe in the initial question below: I had pr...

Why i can't declare following function in Visual C++ "string timeToStr(string);"?

When i'm trying to declare a function with a string parameter in .h file an error occurs. I haven't forgot to include string.h =) Everything builds fine when i'm using char[], but the i want the argument to be a string. ...

C++: Confusing declaration semantics

Hi, After tring my hand at perl and a little bit of C, I am tring to learn C++ and already i am bogged down by the details and pitfalls. Consider this:- int x = 1; { int x = x; // garbage value of x } int const arr = 3; { int arr[arr]; // i am told this is perfectly valid and declares an array of 3 ints !! } Huh, Why the diffe...

PHP: how to avoid redeclaring functions?

I tend to get errors such as: Fatal error: Cannot redeclare get_raw_data_list() (previously declared in /var/www/codes/handlers/make_a_thread/get_raw_data_list.php:7) in /var/www/codes/handlers/make_a_thread/get_raw_data_list.php on line 19 how can I avoid the error? Is it possible to create a IF-clause to check whether a function is ...

Get variable (not hard-coded) name?

I am looking for a way to retrieve the variable name, so I don't have to use hard-coded declarations when needed (for property names etc.): I hardly believe it's possible; maybe someone has a solution. Note: even not variables, properties would also be a move. 'Pseudo: Module Module1 Sub Main() Dim variable = "asdf" ...

ctypes pointer question

Hi everyone - I was reading the ctypes tutorial, and I came across this: s = "Hello, World" c_s = c_char_p(s) print c_s c_s.value = "Hi, there" But I had been using pointers like this: s = "Hello, World!" c_s = c_char_p() c_s = s print c_s c_s.value Traceback (most recent call last): File "<pyshell#17>", line 1, in <module> c...