Hi all,
I have next problem. We have a huge client-server system and use CSLA to operate with DB data. There are a set of WinForms-based clients and one WCF-based AppServer. We have custom logging subsystem and settings for this subsystem are stored in DB. So on initialization of each side of our system (client application or applicatio...
Possible Duplicate:
initializing char arrays in a way similar to initializing string literals
below is a sample of initializing a string literal in which a terminating null character is added at the end of string, necessarily:
char reshte[]="sample string";
I wonder why can't we initialize an array of characters without ter...
Hi all.
I have a question about how is the correct way of manipulate the initialization of c strings
For example the next code, isn't always correct.
char *something;
something = "zzzzzzzzzzzzzzzzzz";
i test a little incrementing the number of zetas and effectively the program crash in like about two lines, so what is the real size li...
class Base{
public:
Base(int val):_id(val){};
int _id;
};
class Derived : Base {
public:
Derived(int val):Base(_id+val){};
};
int main(){
Derived d(60);
}
why doesn't this give an error? Base class is still not constructed but I'm able to use '_id'?
thanks
...
I have this question, which i thought about earlier, but figured it's not trivial to answer
int x = x + 1;
int main() {
return x;
}
My question is whether the behavior of the program is defined or undefined if it's valid at all. If it's defined, is the value of x known in main?
...
must class member initialization lists in c++ be complete? or can they simply initialize one or two of the member data in a class?
thanks in advance!
...
I am struggling to understand why the initialization of pprocessor, below, is written like this:
class X
{
...
private:
boost::scoped_ptr<f_process> pprocessor_;
};
X:X()
: pprocessor_( f_process_factory<t_process>().make() ) //why the factory with template
{...}
instead of just writing
X:X()
: pprocessor_( new t_process() )
{...
There are two entities:
@Entity class A {
@ManyToMany List<B> bs;
}
@Entity class B {}
I now want to duplicate (clone) an instance of class A. Is there any way with Hibernate to make a shallow copy of the persistent collection bs without having to completely initialize all Bs?
In SQL it would be quite easy because you would just ...
I am a final year student making a project in which I take a image from camera placed at car and my objective is through image processing on Matlab. I have to take image of different colour ball until my desired image (which is red) comes and the car stop through micro controller. How can I continuously take a image of ball with millisec...
I'm doing this over and over, and I'm not sure if it is the best way to do so in JavaScript/jQuery. I have a function that acts as an event handler, but also I need to call it on page initialization. Thus I have been using the following code:
<script type="text/javascript">
$(function() {
function doToggle() {
$(...
Following code has to be used in the main-function, but I don't know how it is used.
struct SomeItem
{
enum {MOVIE, MUSIC} itemType;
union {
struct Movie* movie;
struct Music* music;
};
};
this struct is used in a dynamic linked list with previous/item/next pointer, but I don't know how you can set the enum...
I thought one could initialize several variables in a for loop:
for (int i = 0, char* ptr = bam; i < 10; i++) { ... }
But I just found out that this is not possible, gcc gives the following error:
error: expected unqualified-id before 'char'
Is it really true that you can't initialize variables of different types in a for loop?
...
The following code does not work, and throws a RuntimeException caused by NullPointerException
public class ListFilteredActivity extends Activity {
LinearLayout typeSelector = new LinearLayout(this) ;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ScrollView...
I heard that const members must be explicitly intialized, but the following compiles for me:
class someClass
{
int const x;
};
int main()
{
return 0;
}
...
I'm using __attribute__((init_priority(X))) in GCC like this:
Type1 __attribute__ ((init_priority (101))) name1 = value1;
Type2 __attribute__ ((init_priority (102))) name2 = value2;
in different source files. Let's say file1.cpp and file2.cpp.
If I use this in same library it works as expected, name1 is initialized before name2 but i...
In C99 (and not in C++), it's possible to initialize structs using this syntax:
struct info
{
char name[8+1];
int sz;
int typ;
};
struct info arr[] =
{
[0] = { .sz = 20, .name = "abc" },
[9] = { .sz = -1, .name = "" }
};
What happens to the unspecified fields?
...
Why cannot initialize my array of strings in my constructor? I get the following error:
internal compiler error: Segmentation fault|
at these two lines in the constructor:
suits = {"Clubs", "Diamonds", "Hearts", "Spades"};
denominations = {"Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"};
class Card
{
publ...
Dose method -application:didFinishLaunchingWithOptions: run in ios 2.0?
-application:didFinishLaunchingWithOptions: is a delegate method in ios3.0 and later, Will it be wrong in ios 2.0?
...
Using C++ I built a Class that has many setter functions, as well as various functions that may be called in a row during runtime.
So I end up with code that looks like:
A* a = new A();
a->setA();
a->setB();
a->setC();
...
a->doA();
a->doB();
Not, that this is bad, but I don't like typing "a->" over and over again.
So I rewrote my ...
I am trying to compile following code in C#
String[] words = { "Hello", "Worlds" };
words = {"Foo", "Bar"};
and am getting compilation errors like
Error 1 Invalid expression term '{'
Error 2 ; expected
Error 3 Invalid expression term ','
On the other hand if i try
String[] words = { "Hello", "Worlds" };
words = new String[] {"Foo...