gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > vectors won't work

#41953 - LiraNuna - Tue May 03, 2005 6:36 pm

why can't i use vectors?

is this code correct?
Code:

#include <vector>

typedef vector<unsigned> FORMAT_DATA;

#41961 - dXtr - Tue May 03, 2005 8:45 pm

don't know about your <vector> version but most version has there vector class in std namespace.
and btw. unsigned is no datatype.. you need to tell what is unsigned.

so you do like

Code:

#include <vector>

using namespace std;

typedef vector<unsigned int> FORMAT_DATA;


or

Code:

#include <vector>

typedef std::vector<unsigned int> FORMAT_DATA;
[/code]

#42002 - mike260 - Wed May 04, 2005 2:06 am

dXtr wrote:
btw. unsigned is no datatype.. you need to tell what is unsigned.


FYI, 'unsigned' is shorthand for 'unsigned int' and is perfectly legal. Same goes for short, long, const, volatile, and probably most other type modifiers.

#42048 - dXtr - Thu May 05, 2005 2:23 am

mike260 wrote:
dXtr wrote:
btw. unsigned is no datatype.. you need to tell what is unsigned.


FYI, 'unsigned' is shorthand for 'unsigned int' and is perfectly legal. Same goes for short, long, const, volatile, and probably most other type modifiers.


In my world unsigned is no datatype atleast ;)
and from what I know short is a datatype (16bit) so is long (32/64bit) and int comes there between (16/32bit)

#42049 - LOUD NOISES - Thu May 05, 2005 2:37 am

dXtr wrote:
mike260 wrote:
dXtr wrote:
btw. unsigned is no datatype.. you need to tell what is unsigned.


FYI, 'unsigned' is shorthand for 'unsigned int' and is perfectly legal. Same goes for short, long, const, volatile, and probably most other type modifiers.


In my world unsigned is no datatype atleast ;)
and from what I know short is a datatype (16bit) so is long (32/64bit) and int comes there between (16/32bit)


short and long are not data types, they're modifiers (short int, long int, long long int, long double).

#42067 - MrNoonan - Thu May 05, 2005 9:44 am

mike260 wrote:
Same goes for ... const, volatile, and probably most other type modifiers.


That's true in C, but not in C++.

const n = 5; //valid C, but an error in C++.

(BTW const and volatile are technically cv-qualifiers, not type modifiers.)