Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

variable-sized object may not be initialized

Name: Anonymous 2006-02-14 11:10

//int main()
//{
//    int n;
//   
//    cout << "Welcome to a much better class demo!" << endl
//         << "How many employees do you want to index?" << endl;
//    cin  >> n;
//   
//    const int EMS = n;
//   
//    Employee theEmployees[EMS]=
//    {
//         Employee(),
//    };
//}

For some reason this gives me the error "variable-sized object 'theEmployees' may not be initialized"

It works fine with an absolute numerical value for the array size, not sure why the variable won't work.

Name: Anonymous 2006-02-14 11:31

Employee *theEmployees = new Employee[EMS];Now begone.

Name: Anonymous 2006-02-14 14:29

try putting n = 0; as well. Compiler might be picky about making a const int = an uninitaited variable - even though it'd be initiated regardless.

Name: Anonymous 2006-02-14 15:19

Oh god this is stupid.

Name: Anonymous 2006-02-14 16:25

>>3
The compiler should have no problem with it.

>>4
Yes it is.

Name: Anonymous 2006-02-14 16:43

Haha oh wow.

Name: Anonymous 2010-10-04 16:09

Use code tags noob.

Name: Anonymous 2010-10-04 16:20

>>8
There should be default noob tags.

Name: Anonymous 2010-10-04 20:20

Code tags should be enabled by default. They should be opt-out rather than opt-in.

Name: Anonymous 2010-10-04 20:35

Good grief.

X theXs[constint] = { X() };

You're only initialising the first element of an unknown array of Xs.

/thread.

Name: Anonymous 2010-10-04 20:35

Good grief.

X theXs[constint] = { X() };

You're only initialising the first element of an unknown array of Xs.

/thread.

Name: >>11,12 2010-10-04 20:37

lol lag

Name: Anonymous 2012-01-28 11:41

>>1
You forgot code tags, stupid.

Name: Anonymous 2012-01-28 11:44

maybe it is because you commented every line?

Name: Anonymous 2012-01-28 11:57


#include <stdio.h>

int main(void) {(void)(printf("hax my anus\n");return 0;}

Name: Anonymous 2012-01-28 13:22

>>`
>unmatched parentheses

Name: Anonymous 2012-01-28 17:17

Get your near initialization sorted out, faggot.

Name: Anonymous 2012-01-28 21:36

You are a terrible programmer. I am disgusted by your use of iostream.

Name: Anonymous 2012-01-28 21:40

>>19
There are some weenie programmers on the FreeBSD project that believe in "pure functions." So these homos will do something like the following..

(void)printf("Some shit\n");

In an effort to ram their programming religion down the throats of other people.

Name: Anonymous 2012-01-28 22:10

>>20
HOW DARE THEY PROGRAM HOW THEY LIKE TO

Name: Anonymous 2012-01-28 22:54

skank my dick

Don't change these.
Name: Email:
Entire Thread Thread List