declaration

Haxe syntax; what does the following mean?

I have the following bit of syntax: Void -> Void //in context example private var _onClickEvents : List < Void -> Void > ; which seems to be accepted as a type definition, the same as Bool or TextField. I presume it has similar use to how Haskell defines function type signatures? ...

Is it possible to configure non-global listeners declaratively?

Is it possible to configure (registering with scheduler) non-global job listeners declaratively in properties file (rather than programmatically) similar to configuring global listeners? Check here for: Programmatically adding a global job listener Programmatically adding a non-global job listener EDIT: Example for configuring a Glo...

Definition/Initialization of Global Variables: Common Practice? (Geared towards C#)

I kind of posted a similar question a couple of days ago but that was more geared towards any *.Designer.cs file. This question is geared towards declaration and initialization of global variables within a class. To my knowledge, it's almost common practice (aside from the *.Designer.cs files it seems) to place all global variables at ...

Mix Objection Notation and regular Style in Javascript Functions?

Hi, A small question for versed javascript programmers: There are two ways to declare a function in javascript. A: javascript-object-notation function MyLittleHouseA(name) { this.age = 88, this.name = name, this.getName = function() { return this.name; } } B: uhm, normal: function MyLittleHouseB(name) { ...

function vs variable declaration in C++

This code works: std::ifstream f(mapFilename.c_str()); std::string s = std::string(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>()); ParseGameState(s); Whereby mapFilename is an std::string and void ParseGameState(const std::string&);. And this does not: std::ifstream f(mapFilename.c_str()); std::string s(std::is...

Spiral rule and 'declaration follows usage' for parsing C expressions

This question follows this other question about C declaration. Reading the answer to this question, I read about the spiral rule and I also understood what "declaration follows usage" means. Ok so far. But then I read this declaration: char *(*(*a[N])())(); and I was wondering how to parse it with the "declaration follows usage" 'ru...

Add keys/values to Dictionary at declaration.

Very easy today, I think. In C#, its: Dictionary<String, String> dict = new Dictionary<string, string>() { { "", "" } }; But in vb, the following doesn't work. Public dict As Dictionary(Of String, String) = New Dictionary(Of String, String) (("","")) I'm pretty sure there's a way to add them at declaration, but I'm not sure how. ...

C++: automatic initialization

I find it sometimes annoying that I have to initialise all POD-types manually. E.g. struct A { int x; /* other stuff ... */ A() : x(0) /*...*/ {} A(/*..*/) : x(0) /*...*/ {} }; I don't like this for several reasons: I have to redo this in every constructor. The initial value is at a different place than the variable...

declaring a pointer to a two dimension array of void*

I'm having trouble figuring out how to declare a pointer to an array of arrays of void*. (I can't use STL containers and the like because it's an embedded system.) I have some data that I'm trying to group together in a structure. Mostly built-in data types, but then are these two arrays. The first one, char *testpanel_desc[] = {...}; ...

c string basics, why unassigned?

Hi, I am trying to learn the basics, I would think that declaring a char[] and assigning a string to it would work. thanks int size = 100; char str[size]; str = "\x80\xbb\x00\xcd"; gives error "incompatible types in assignment". what's wrong? thanks ...

What's the difference between @class Foo and import "Foo.h"?

What's the difference when using these codes: #import <UIKit/UIKit.h> #import "Foo.h" @interface EditFooViewController : UIViewController { Foo *foo; } @end and #import <UIKit/UIKit.h> @class Foo; @interface EditFooViewController : UIViewController { Foo *foo; } @end ...

is there any way to inline just some selective calls to a function not all of them?

Is there any way to inline just some selective calls to a particular function not all of them? cause only form I know is declaring function as such at beginning and that's supposed to effect all calls to that function. ...

Where to put declaration in Objective C

I have a file1.h file1.m file1.xib the xib has a blank screen with a label on it. I have another file that does some arbitrary calculation and will update the label as the calculation loops. Where should I declare the UILabel * value in file1.h or the file that does the calculations? Thank you drive around. ...

c#: (Static) Class-Level Variables

This is definitely a bit of a noob question, but my searches so afar haven't cleared the issue up for me. A want a particular console app to store several class-level variables. In one case, I want to store a copy of my logging object, which I'll use in various places within the class. In another case, I want to store a simple type, a i...

Declaration or Definition

I have a confusion about declaration and definition. In the statement int switchon(float duration); Q1. Is the parameter 'duration' being defined or is it being declared? As per section 3.1/2 of the holy Standard, it is a definition, but I am unable to understand why. Q2. What is the exact difference between declaration and defini...

Ambiguous declarations

What is the difference between the following two declarations: 1. int foo(int); 2. int foo(int()); I am not sure if both the declarations are equivalent. What makes (2) different from (1)? ...

Property Declaration

OrderDetailsView.h #import <UIKit/UIKit.h> @protocol OrderDetailsViewDelegate; @interface OrderDetailsView : UIViewController { IBOutlet UITextView *OrderDetails; NSString *selectedOrder; id <OrderDetailsViewDelegate> delegate; } @property (nonatomic, assign) id <OrderDetailsViewDelegate> del...

Faster to declare variables inside a loop or outside a loop?

Is it faster to declare variables inside a loop or outside a loop? For example: ' Declaration inside of the loop For each item in items Dim newVariable as String = GetAString() Next ' Declaration outside of the loop Dim newVariable as String = String.Empty For each item in items newVariable = GetAString() Next Which one is fa...

Is this code valid C++ ?

Is the following code valid C++? const int var = 10; { int var[var]; // why doesn't this give any error ? } Note : The code compiles on my g++ compiler. ...

What's the difference between theese two java variable declarations?

in java... public class someclass { private HashSet<Someobject> contents = new HashSet<Someobject>(); private Set<Someobject> contents2 = new HashSet<Someobject>(); } what's the difference? in the end it's both a hashset isn't it? the second one looks just wrong to me but i have seen it frequently used, accepted and working......