dev-cpp-users Mailing List for Dev-C++ (Page 425)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Jeeun C. <koo...@ya...> - 2003-03-06 06:09:31
|
this is the program dat i wrote... when i ran it, it WORKED wELL!! but wen i ran it with the other compiler, it didnt work... so..i put some output for string length to check if it's right,i got 0 for the string length... how can i get it ryte? i thought i need to use .length() or .size() to get the length...am i wrong? thanks!! __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ |
|
From: Ioannis V. <no...@ho...> - 2003-03-06 04:17:01
|
-------Original Message-------=0D
=0D
From: Jeeun Cho=0D
Date: =D0=DD=EC=F0=F4=E7, 6 =CC=DC=F1=F4=E9=EF=F2 2003 5:56:10 =F0=EC=0D
To: dev c=0D
Subject: [Dev-C++] 2-D array=0D
=0D
if i wanna use 2-D array, aka matrix, wut kind of=0D
headliner do i need to use?=0D
=0D
=0D
=3D=3D> In C++:=0D
=0D
#include <vector>=0D
=0D
int main()=0D
{=0D
using std::vector;=0D
=0D
// Creates a 50x20 of int with initial value 0=0D
vector<vector<int> > darray(50,vector<int>(20));=0D
=0D
=0D
//1-dimensional with initial value 0=0D
vector<int>sarray(50);=0D
=0D
=0D
In C:=0D
=0D
/* 20x10 */=0D
int mypoorarray[20][10];=0D
=0D
=0D
=0D
Ioannis Vranos=0D
=0D
* Programming pages: http://www.noicys.freeurl.com=0D
* Alternative URL: http://run.to/noicys=20 |
|
From: Robson B. <rob...@su...> - 2003-03-06 04:04:27
|
> if i wanna use 2-D array, aka matrix, wut kind of
> headliner do i need to use?
just declare your array:
int myArray[2][2] = {{2, 4,}, {5, 5}};
|
|
From: Jeeun C. <koo...@ya...> - 2003-03-06 03:53:15
|
if i wanna use 2-D array, aka matrix, wut kind of headliner do i need to use? __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ |
|
From: Ioannis V. <no...@ho...> - 2003-03-06 01:18:10
|
A fix: =0D
=0D
bitset<numeric_limits<char>::digits *2>tag('a');=0D
tag<<=3Dnumeric_limits<char>::digits;=0D
tag&=3Dbitset<numeric_limits<char>::digits *2>('b');=0D
=0D
It is completely portable.=0D
=0D
=0D
=0D
Ioannis Vranos=0D
=0D
* Programming pages: http://www.noicys.freeurl.com=0D
* Alternative URL: http://run.to/noicys=20 |
|
From: NimoTh <Ni...@gm...> - 2003-03-05 21:58:44
|
Hello Dev-C++ Users, I seem to have a problem with the code completion tool. When I type 'cin.getline(..)' it actually should start the code completion tool after pausing at the dot, right? Well, nothing happens. My time out is set to 250 something milliseconds. More or less related to this, I can't get DC to automatically marking logically connected brackets when positioning the curser one. I remember DC always marking the second one but for some reason this is just not working anymore. Now, I _did_ search the archive for this problem. However, the search funktion seems to be messy. The one topic I found did not contain an answer. So, I hope you guys can help me with this. -- Have a good day, NimoTh |
|
From: Per W. <pw...@ia...> - 2003-03-05 13:24:55
|
Be very, VERY careful of strtok(), since it requires the change of your
original buffer. It inserts '\0' characters at the end of the token, but
that might be a valid character of something new, i.e.
char *p,buf[] = "charlie(a,b);"
p = strtok(buf,"(),\n\r");
if (p && !strcmp(p,"charlie")) {
// oops, did strtok end with a '(', ')', '\n', '\r' or '\0' or what?
// information has been overwritten :-(
}
/Per W
On Tue, 4 Mar 2003, Matthews wrote:
> A small question:
>
> I'm in the process of creating a scripting language for a game creation
> system that I use. The method I use is to
>
> 1) Grab a line (seperated by semi-colons like C) from the file
> 2) Get the length of the command (with a small for() loop that increments a
> length variable until a space is reached)
> 3) Compare the string to each valid command
> 4) If a match is found, perform a parameter count (a variation of the
> previous loop) and make sure there are the correct number
> 5) Write command bytecode with parameters to compiled script file.
>
> This almost works perfectly, there's a strange bug related to a two-part
> command that sometimes makes the compiler believe there's one more
> parameter than there actually is. That's not my question though. My
> question is how could strtok() help me in this situation I've described?
> I'm not sure how it works, and I'm wondering if it could make my job easier
> by breaking the line down into different parts for easy counting/comparing.
>
> Thanks in advance.
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Per W. <pw...@ia...> - 2003-03-05 13:19:22
|
I didn't say your code wasn't portable, I just said that it didn't solve
the real problem, which is where the different characters that are stored
where in the integer.
Since the standard doesn't define it, a portable solutions have to perform
an analysis and adapt to compiler and architecture used. We don't know if
the characters are aligned to least and/or most significant bit of the
integer, and we don't know if the first character of the multicharacter
literal is in higher or lower bits relative the second character of the
literal.
/Per W
On Wed, 5 Mar 2003, Ioannis Vranos wrote:
> -------Original Message-------
>
> From: Per Westermark
> Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 2:39:12 =EC=EC
> To: Ioannis Vranos
> Cc: Dev-C++ Mailing List
> Subject: Re: [Dev-C++] Character variables
>
> If I need a set of 100 bits, the bitset implementation is nice, but for
> multicharacter manipulation it doesn't give an improved portability, whil=
e
> it is more code than
>
> (unsigned('a') << 8) | unsigned('b')
>
>
> =3D=3D> Why isn't my code portable?
>
>
> bitset<numeric_limits<char>::digits10 *2>tag('a');
>
> tag<<=3Dnumeric_limits<char>::digits10;
>
> tag&=3Dbitset<numeric_limits<char>::digits10 *2>('b');
>
>
> =3D=3D> It is completely portable.
>
>
> =3D=3D> Yes it is more code than your code above because my code was made=
to be
> portable. The equivalent would be:
>
>
> (bitset<sizeof(unsigned)>('a')<<8) | bitset<sizeof(unsigned)>('b')
>
>
>
>
> The problem is still that depending on machine and compiler I might have
> to do
> (unsigned('b') << 8) | unsigned('a')
> or
> (unsigned('a') << 24) | unsigned('b')
> or
> (unsigned('b') << 24) | unsigned('a')
> or
> ...
> instead, because there isn't a defined standard how the individual
> characters should be stored in the integer.
>
>
> =3D=3D> ?
>
>
> Ioannis Vranos
>
> * Programming pages: http://www.noicys.freeurl.com
> * Alternative URL: http://run.to/noicys
|
|
From: Matthews <dem...@uw...> - 2003-03-05 13:00:08
|
A small question: I'm in the process of creating a scripting language for a game creation system that I use. The method I use is to 1) Grab a line (seperated by semi-colons like C) from the file 2) Get the length of the command (with a small for() loop that increments a length variable until a space is reached) 3) Compare the string to each valid command 4) If a match is found, perform a parameter count (a variation of the previous loop) and make sure there are the correct number 5) Write command bytecode with parameters to compiled script file. This almost works perfectly, there's a strange bug related to a two-part command that sometimes makes the compiler believe there's one more parameter than there actually is. That's not my question though. My question is how could strtok() help me in this situation I've described? I'm not sure how it works, and I'm wondering if it could make my job easier by breaking the line down into different parts for easy counting/comparing. Thanks in advance. |
|
From: Per W. <pw...@ia...> - 2003-03-05 12:53:30
|
And if you check closer, for shift operations it's the >> that is implementation specific, i.e. if it will do an arithmetic or logic shift right for signed numbers. The << is always ok, i.e. will always shift in a zero. Is's only when you try to use it to multiply with 2, you have to note that because of overflow, you might shift away your sign bit, resulting in a bit of confusion, i.e. [16-bit integers]: -20000 (0xB1E0) << 1 results in 25536 (0x63c0) but then all operators will give more or less strange results when operated outside the available numeric range. About compatibility with strange architectures, I don't expect us to have to see too many machines with 9-bit characters and 36-bit integers anymore, as existed for some big old iron. Such a computer manufacturer would now have too hard a time trying to attract both compiler vendors and actual end users. /Per W On Wed, 5 Mar 2003, Ioannis Vranos wrote: > -------Original Message------- > > From: Per Westermark > Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 2:04:36 =EC=EC > To: Ioannis Vranos > Cc: Dev-C++ Mailing List > Subject: Re: [Dev-C++] Character variables > > The shift operators are of course defiend for both signed and unsigned > data types. > > It's just that for >> you may not assume if it will shift in a '0' or a > '1' in the most significant bit fir signed integers, i.e. > > -3 (0xfffd) >> 1 =3D 32766 (0x7ffe) > -3 (0xfffd) >> 1 =3D -2 (0xfffe) > > depending on implementation. > > However, when shifting in characters into a 32-bit integer, I don't have > to care about this, since << always shifts in 0 in the least significant > bit. > > > =3D=3D> Yes bitwise operators can be applied to integral types signed and > unsigned however in signed types the behaviour is implementation > dependent/undefined. This is explicitly mentioned in the C99 standard: > > =3D=3D> "Some operators (the unary operator ~, and the binary operators <= <, >>, > &, ^, and |, > collectively described as bitwise operators) are required to have operand= s > that have > integer type. These operators return values that depend on the internal > representations of > integers, and have implementation-defined and undefined aspects for signe= d > types." > > > =3D=3D> The above is not mentioned explicitly in the C++98 standard, but = it is > common sense. That's why i spoke about bad magic. :) > > > > Ioannis Vranos > > * Programming pages: http://www.noicys.freeurl.com > * Alternative URL: http://run.to/noicys |
|
From: Ioannis V. <no...@ho...> - 2003-03-05 12:45:12
|
-------Original Message-------=0D
=0D
From: Per Westermark=0D
Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 2:39:12 =EC=EC=0D
To: Ioannis Vranos=0D
Cc: Dev-C++ Mailing List=0D
Subject: Re: [Dev-C++] Character variables=0D
=0D
If I need a set of 100 bits, the bitset implementation is nice, but for=0D
multicharacter manipulation it doesn't give an improved portability, whil=
e=0D
it is more code than=0D
=0D
(unsigned('a') << 8) | unsigned('b')=0D
=0D
=0D
=3D=3D> Why isn't my code portable?=0D
=0D
=0D
bitset<numeric_limits<char>::digits10 *2>tag('a');=0D
=0D
tag<<=3Dnumeric_limits<char>::digits10;=0D
=0D
tag&=3Dbitset<numeric_limits<char>::digits10 *2>('b');=0D
=0D
=0D
=3D=3D> It is completely portable.=0D
=0D
=0D
=3D=3D> Yes it is more code than your code above because my code was made=
to be
portable. The equivalent would be:=0D
=0D
=0D
(bitset<sizeof(unsigned)>('a')<<8) | bitset<sizeof(unsigned)>('b')=0D
=0D
=0D
=0D
=0D
The problem is still that depending on machine and compiler I might have=0D
to do=0D
(unsigned('b') << 8) | unsigned('a')=0D
or=0D
(unsigned('a') << 24) | unsigned('b')=0D
or=0D
(unsigned('b') << 24) | unsigned('a')=0D
or=0D
=2E..=0D
instead, because there isn't a defined standard how the individual=0D
characters should be stored in the integer.=0D
=0D
=0D
=3D=3D> ?=0D
=0D
=0D
Ioannis Vranos=0D
=0D
* Programming pages: http://www.noicys.freeurl.com=0D
* Alternative URL: http://run.to/noicys=20 |
|
From: Per W. <pw...@ia...> - 2003-03-05 12:40:33
|
If I need a set of 100 bits, the bitset implementation is nice, but for
multicharacter manipulation it doesn't give an improved portability, while
it is more code than
(unsigned('a') << 8) | unsigned('b')
The problem is still that depending on machine and compiler I might have
to do
(unsigned('b') << 8) | unsigned('a')
or
(unsigned('a') << 24) | unsigned('b')
or
(unsigned('b') << 24) | unsigned('a')
or
...
instead, because there isn't a defined standard how the individual
characters should be stored in the integer.
/Per W
On Wed, 5 Mar 2003, Ioannis Vranos wrote:
> -------Original Message-------
>
> From: Per Westermark
> Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 1:29:06 =EC=EC
> To: Ioannis Vranos
> Cc: Dev-C++ Mailing List
> Subject: Re: [Dev-C++] Character variables
>
> No, multicharacter literals they are not specifically indented for
> wchar_t.
>
> They are defined to be of type int, and if you want store multiple char
> characters, you write:
> int i =3D 'abcd'
> and for wchar_t
> int i =3D L'ab'
> where a 32-bit integer only have room for two wide characters.
>
>
> =3D=3D> Yes but their meaning is implementation defined. I do not know mu=
ch for
> them, and have only met them in one paragraph in TC++PL up to now that i =
am
> on chapter 19.
>
>
>
>
> The problematic non-standard issue with multicharacter literals is that
> you are not guaranteed to know byte order of the machine, and the order
> the multiple characters are stored in the integer, so you have to do some
> condintional compilation if you want to save/load them.
>
> You might have to do something like
> #if '1234' =3D=3D 0x31323334L
> // init alternative 1
> #elseif '1234' =3D=3D 0x34333231L
> // init alternative 2
> #else
> // no known byte order
> #endif
>
> Even if you use bitset, you still have to check which character goes into
> the high bits, and which character goes to the low bits of the integer.
>
>
> =3D=3D> Personally i can't find any use of them, if you want to add them =
in
> specific order in a bitset you can do:
>
>
> bitset<numeric_limits<char>::digits10 *2>tag('a');
>
> tag<<=3Dnumeric_limits<char>::digits10;
>
> tag&=3Dbitset<numeric_limits<char>::digits10 *2>('b');
>
>
> (i made a mistake in a previous email where i combined 2 different bitset
> types (bitset<32> with bitset<4>).
>
>
> PS - thx for the pdf reference, I haven't had access to a
> computer-readable edition before :-)
>
>
> =3D=3D> Yes, all standards now come in .pdf form. It's the same .pdf as s=
old
> from ISO web site.
>
>
> Ioannis Vranos
>
> * Programming pages: http://www.noicys.freeurl.com
> * Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ho...> - 2003-03-05 12:22:08
|
-------Original Message-------=0D =0D From: Per Westermark=0D Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 2:04:36 =EC=EC=0D To: Ioannis Vranos=0D Cc: Dev-C++ Mailing List=0D Subject: Re: [Dev-C++] Character variables=0D =0D The shift operators are of course defiend for both signed and unsigned=0D data types.=0D =0D It's just that for >> you may not assume if it will shift in a '0' or a=0D '1' in the most significant bit fir signed integers, i.e.=0D =0D -3 (0xfffd) >> 1 =3D 32766 (0x7ffe)=0D -3 (0xfffd) >> 1 =3D -2 (0xfffe)=0D =0D depending on implementation.=0D =0D However, when shifting in characters into a 32-bit integer, I don't have=0D to care about this, since << always shifts in 0 in the least significant=0D bit.=0D =0D =0D =3D=3D> Yes bitwise operators can be applied to integral types signed and unsigned however in signed types the behaviour is implementation dependent/undefined. This is explicitly mentioned in the C99 standard:=0D =0D =3D=3D> "Some operators (the unary operator ~, and the binary operators <= <, >>, &, ^, and |,=0D collectively described as bitwise operators) are required to have operand= s that have=0D integer type. These operators return values that depend on the internal representations of=0D integers, and have implementation-defined and undefined aspects for signe= d types."=0D =0D =0D =3D=3D> The above is not mentioned explicitly in the C++98 standard, but = it is common sense. That's why i spoke about bad magic. :)=0D =0D =0D =0D Ioannis Vranos=0D =0D * Programming pages: http://www.noicys.freeurl.com=0D * Alternative URL: http://run.to/noicys=20 |
|
From: Ioannis V. <no...@ho...> - 2003-03-05 12:14:47
|
-------Original Message-------=0D
=0D
From: Per Westermark=0D
Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 1:29:06 =EC=EC=0D
To: Ioannis Vranos=0D
Cc: Dev-C++ Mailing List=0D
Subject: Re: [Dev-C++] Character variables=0D
=0D
No, multicharacter literals they are not specifically indented for=0D
wchar_t.=0D
=0D
They are defined to be of type int, and if you want store multiple char=0D
characters, you write:=0D
int i =3D 'abcd'=0D
and for wchar_t=0D
int i =3D L'ab'=0D
where a 32-bit integer only have room for two wide characters.=0D
=0D
=0D
=3D=3D> Yes but their meaning is implementation defined. I do not know mu=
ch for
them, and have only met them in one paragraph in TC++PL up to now that i =
am
on chapter 19.=0D
=0D
=0D
=0D
=0D
The problematic non-standard issue with multicharacter literals is that=0D
you are not guaranteed to know byte order of the machine, and the order=0D
the multiple characters are stored in the integer, so you have to do some=
=0D
condintional compilation if you want to save/load them.=0D
=0D
You might have to do something like=0D
#if '1234' =3D=3D 0x31323334L=0D
// init alternative 1=0D
#elseif '1234' =3D=3D 0x34333231L=0D
// init alternative 2=0D
#else=0D
// no known byte order=0D
#endif=0D
=0D
Even if you use bitset, you still have to check which character goes into=
=0D
the high bits, and which character goes to the low bits of the integer.=0D
=0D
=0D
=3D=3D> Personally i can't find any use of them, if you want to add them =
in
specific order in a bitset you can do:=0D
=0D
=0D
bitset<numeric_limits<char>::digits10 *2>tag('a');=0D
=0D
tag<<=3Dnumeric_limits<char>::digits10;=0D
=0D
tag&=3Dbitset<numeric_limits<char>::digits10 *2>('b');=0D
=0D
=0D
(i made a mistake in a previous email where i combined 2 different bitset
types (bitset<32> with bitset<4>).=0D
=0D
=0D
PS - thx for the pdf reference, I haven't had access to a=0D
computer-readable edition before :-)=0D
=0D
=0D
=3D=3D> Yes, all standards now come in .pdf form. It's the same .pdf as s=
old
from ISO web site.=0D
=0D
=0D
Ioannis Vranos=0D
=0D
* Programming pages: http://www.noicys.freeurl.com=0D
* Alternative URL: http://run.to/noicys=20 |
|
From: Per W. <pw...@ia...> - 2003-03-05 12:05:58
|
The shift operators are of course defiend for both signed and unsigned
data types.
It's just that for >> you may not assume if it will shift in a '0' or a
'1' in the most significant bit fir signed integers, i.e.
-3 (0xfffd) >> 1 =3D 32766 (0x7ffe)
-3 (0xfffd) >> 1 =3D -2 (0xfffe)
depending on implementation.
However, when shifting in characters into a 32-bit integer, I don't have
to care about this, since << always shifts in 0 in the least significant
bit.
/Per W
On Wed, 5 Mar 2003, Ioannis Vranos wrote:
> Some adjustments:
>
>
>
> -------Original Message-------
>
> From: Ioannis Vranos
> Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 12:55:26 =F0=EC
> To: Dev-C++ Mailing List
> Subject: Re: [Dev-C++] Character variables
>
> -------Original Message-------
>
> From: Per Westermark
> Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 12:26:51 =F0=EC
> To: Giligun
> Cc: C++
> Subject: Re: [Dev-C++] Character variables
>
> short s =3D 'ab';
> int i =3D 'abcd';
>
> given that int is 4 byte.
>
>
> =3D=3D> That isn't valid C++. And where it gets compiled you can't consid=
er it
> as safe.
>
>
>
> But a lot of compilers will give you warnings, since it you can't be sure
> if memcpy(buf,&s,sizeof(s)) will give you
> buf[0] =3D 'a', buf[1] =3D 'b';
> or
> buf[0] =3D 'b', buf[1] =3D 'a';
>
> In short - be very careful about using this feature. One place where it's
> elegant to use is if you are reading a tagged file, where each tag is
> 4-byte long:
> char *buf;
>
> int tag =3D 0;
> for (i =3D 0; i < 4; i++) {
> tag =3D (tag << 8) | *buf++;
> }
>
>
> =3D=3D> Too system dependent. Additionally bitwise operators are to be us=
ed in
> unsigned integrals only.
>
> =3D=3D> He could use wchar_t instead. But since he wants to store charact=
ers
> (assuming in the range 0-127) he can use a char sequence nicely and easil=
y.
>
>
> switch (tag) {
> case 'STRT': ...; break;
> case 'HEDR': ...; break;
> case 'DATA': ...; break;
> case 'ENDF': ...; break;
> }
>
> If there are a lot of tags, the result is a very fast matching of the
> tags.
>
>
> =3D=3D> By the way i would do something like the above using std::bitset.
>
>
>
> Ioannis Vranos
>
> * Programming pages: http://www.noicys.freeurl.com
> * Alternative URL: http://run.to/noicys
|
|
From: Per W. <pw...@ia...> - 2003-03-05 11:53:15
|
I don't think multicharacter literals are newbie questions. Especially since they are implementation specific in the compiler. /Per W On Wed, 5 Mar 2003, Daniel Glenfield wrote: > I find newbie questions useful actually - there are some things I've not > covered for a while and a refresher is nice. > > Plus they're the only ones I can answer with any confidence!!! lol > > Keep posting. > > > > >From: "Daniel K. O." <dan...@ya...> > >To: <too...@ya...>,"C++" <dev...@li...= t> > >Subject: RES: [Dev-C++] Character variables > >Date: Tue, 4 Mar 2003 19:34:15 -0300 > > > > > > > > > > > > > >Why are you trying to learn C from scratch asking this mailing list? Isn= 't > >more effective to buy/download a book/tutorial on the internet? Somethin= g > >like http://www.geocities.com/tom_torfs/c.html > > > > > > > >Daniel K. O. > > > >It's OK to be ignorant; it's not OK to play stupid. > >http://www.catb.org/~esr/faqs/smart-questions.html > > > > > > > > > > > > > > > > > -----Mensagem original----- > > > De: dev...@li... > > > [mailto:dev...@li...]Em nome de Giligu= n > > > Enviada em: ter=E7a-feira, 4 de mar=E7o de 2003 19:02 > > > Para: C++ > > > Assunto: [Dev-C++] Character variables > > > > > > > > > How does one get a char variable to hold more than one > > > character? Or what other type should be used? > > > > > > >_______________________________________________________________________ > >Busca Yahoo! > >O servi=E7o de busca mais completo da Internet. O que voc=EA pensar o Ya= hoo! > >encontra. > >http://br.busca.yahoo.com/ > > > > > >------------------------------------------------------- > >This SF.net email is sponsored by: Etnus, makers of TotalView, The debug= ger > >for complex code. Debugging C/C++ programs can leave you feeling lost an= d > >disoriented. TotalView can help you find your way. Available on major UN= IX > >and Linux platforms. Try it free. www.etnus.com > >_______________________________________________ > >Dev-cpp-users mailing list > >Dev...@li... > >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > _________________________________________________________________ > Express yourself with cool emoticons http://messenger.msn.co.uk > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Daniel G. <sp...@ho...> - 2003-03-05 11:32:30
|
I find newbie questions useful actually - there are some things I've not covered for a while and a refresher is nice. Plus they're the only ones I can answer with any confidence!!! lol Keep posting. >From: "Daniel K. O." <dan...@ya...> >To: <too...@ya...>,"C++" <dev...@li...> >Subject: RES: [Dev-C++] Character variables >Date: Tue, 4 Mar 2003 19:34:15 -0300 > > > > > > >Why are you trying to learn C from scratch asking this mailing list? Isn't >more effective to buy/download a book/tutorial on the internet? Something >like http://www.geocities.com/tom_torfs/c.html > > > >Daniel K. O. > >It's OK to be ignorant; it's not OK to play stupid. >http://www.catb.org/~esr/faqs/smart-questions.html > > > > > > > > > -----Mensagem original----- > > De: dev...@li... > > [mailto:dev...@li...]Em nome de Giligun > > Enviada em: terça-feira, 4 de março de 2003 19:02 > > Para: C++ > > Assunto: [Dev-C++] Character variables > > > > > > How does one get a char variable to hold more than one > > character? Or what other type should be used? > > > >_______________________________________________________________________ >Busca Yahoo! >O serviço de busca mais completo da Internet. O que você pensar o Yahoo! >encontra. >http://br.busca.yahoo.com/ > > >------------------------------------------------------- >This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger >for complex code. Debugging C/C++ programs can leave you feeling lost and >disoriented. TotalView can help you find your way. Available on major UNIX >and Linux platforms. Try it free. www.etnus.com >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Express yourself with cool emoticons http://messenger.msn.co.uk |
|
From: Per W. <pw...@ia...> - 2003-03-05 11:30:29
|
No, multicharacter literals they are not specifically indented for
wchar_t.
They are defined to be of type int, and if you want store multiple char
characters, you write:
int i =3D 'abcd'
and for wchar_t
int i =3D L'ab'
where a 32-bit integer only have room for two wide characters.
The problematic non-standard issue with multicharacter literals is that
you are not guaranteed to know byte order of the machine, and the order
the multiple characters are stored in the integer, so you have to do some
condintional compilation if you want to save/load them.
You might have to do something like
#if '1234' =3D=3D 0x31323334L
// init alternative 1
#elseif '1234' =3D=3D 0x34333231L
// init alternative 2
#else
// no known byte order
#endif
Even if you use bitset, you still have to check which character goes into
the high bits, and which character goes to the low bits of the integer.
/Per W
PS - thx for the pdf reference, I haven't had access to a
computer-readable edition before :-)
On Wed, 5 Mar 2003, Ioannis Vranos wrote:
> -------Original Message-------
>
> From: Per Westermark
> Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 10:03:30 =F0=EC
> To: Ioannis Vranos
> Cc: Dev-C++ Mailing List
> Subject: Re: [Dev-C++] Character variables
>
> One more thing. I haven't a standard available right now, and a prelimina=
r
> google only picked up an old -97 preliminary C++ standard.
>
> There you have your multicharacter literals in chapter 2 lexical
> conventions.
>
>
> =3D=3D> Yes but they are intended for wchar_t.
>
>
> http://anubis.dkuug.dk/jtc1/sc22/open/n2356/
>
>
> =3D=3D> Squeezing google for maximum efficiency reveals many sites. :) On=
e of
> them is this:
>
> http://www.rgai.hu/~beszedes/munka/
>
>
> However i do not know if downloading the pdf is legal. Damn, life is full=
of
> temptations...
>
>
>
> Ioannis Vranos
>
> * Programming pages: http://www.noicys.freeurl.com
> * Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ho...> - 2003-03-05 10:00:54
|
=0D -------Original Message-------=0D =0D From: Ioannis Vranos=0D Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 11:54:32 =F0=EC= =0D To: Dev-C++ Mailing List=0D Subject: Re: [Dev-C++] Character variables=0D =0D =0D =0D =3D=3D> Squeezing google for maximum efficiency reveals many sites. :) On= e of them is this:=0D =0D http://www.rgai.hu/~beszedes/munka/=0D =0D =0D However i do not know if downloading the pdf is legal. Damn, life is full= of temptations...=0D =0D =0D =3D=3D> For example another site Google reveals is:=0D =0D http://www.fh-worms.de/~progbau/Vorlesungen/SW-Entwicklung/C++/Standard/=0D =0D =0D =3D=3D> As i said though, downloading the pdf is probably illegal...=0D =0D =0D =0D Ioannis Vranos=0D =0D * Programming pages: http://www.noicys.freeurl.com=0D * Alternative URL: http://run.to/noicys=20 |
|
From: Ioannis V. <no...@ho...> - 2003-03-05 09:52:16
|
-------Original Message-------=0D =0D From: Per Westermark=0D Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 10:03:30 =F0=EC= =0D To: Ioannis Vranos=0D Cc: Dev-C++ Mailing List=0D Subject: Re: [Dev-C++] Character variables=0D =0D One more thing. I haven't a standard available right now, and a prelimina= r=0D google only picked up an old -97 preliminary C++ standard.=0D =0D There you have your multicharacter literals in chapter 2 lexical=0D conventions.=0D =0D =0D =3D=3D> Yes but they are intended for wchar_t.=0D =0D =0D http://anubis.dkuug.dk/jtc1/sc22/open/n2356/=0D =0D =0D =3D=3D> Squeezing google for maximum efficiency reveals many sites. :) On= e of them is this:=0D =0D http://www.rgai.hu/~beszedes/munka/=0D =0D =0D However i do not know if downloading the pdf is legal. Damn, life is full= of temptations...=0D =0D =0D =0D Ioannis Vranos=0D =0D * Programming pages: http://www.noicys.freeurl.com=0D * Alternative URL: http://run.to/noicys=20 |
|
From: Ioannis V. <no...@ho...> - 2003-03-05 09:39:44
|
-------Original Message-------=0D
=0D
From: Per Westermark=0D
Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 9:39:19 =F0=EC=0D
To: Ioannis Vranos=0D
Cc: Dev-C++ Mailing List=0D
Subject: Re: [Dev-C++] Character variables=0D
=0D
The next step of from the 32-bit case statement below would be to use a=0D
hash table.=0D
=0D
However, how would you replace the switch statement with std::bitset?=0D
=0D
=0D
=3D=3D> At first as i said applying the bitwise operators on a signed int=
eger is
bad magic. They are intended for unsigned integrals only. Violation of th=
is
can lead to overflows and open the door of our Universe to dragons, elves
and other bad-meaning creatures.=0D
=0D
=0D
How i would replace the switch statement with bitset:=0D
=0D
Let's assume we had:=0D
=0D
bitset<32>tag(0);=0D
=0D
// I assume you wanted this:=0D
bitset<4>buf('a'+'b');=0D
=0D
for (size_t i =3D 0; i < 4; i++)=0D
tag =3D (tag << 8) | buf[i++];=0D
=0D
=0D
switch (tag.to_ulong())=0D
{=0D
case 'STRT': ...; break;=0D
case 'HEDR': ...; break;=0D
case 'DATA': ...; break;=0D
case 'ENDF': ...; break;=0D
}=0D
=0D
=0D
Ioannis Vranos=0D
=0D
* Programming pages: http://www.noicys.freeurl.com=0D
* Alternative URL: http://run.to/noicys=20 |
|
From: Vlada D. <dj...@im...> - 2003-03-05 08:06:48
|
----- Original Message ----- From: "Robson Bernard" <rob...@su...> To: "C++ Mail List" <dev...@li...> Sent: Wednesday, March 05, 2003 12:57 AM Subject: [Dev-C++] Winsock > Does anybody has a good example of how to use winsock and/or sql routines? > > Thanks! > http://blacksun.box.sk/programming.html Here you can find a lot of stuff about programming and, networks, databases etc. > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger > for complex code. Debugging C/C++ programs can leave you feeling lost and > disoriented. TotalView can help you find your way. Available on major UNIX > and Linux platforms. Try it free. www.etnus.com > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Per W. <pw...@ia...> - 2003-03-05 08:04:41
|
One more thing. I haven't a standard available right now, and a preliminar google only picked up an old -97 preliminary C++ standard. There you have your multicharacter literals in chapter 2 lexical conventions. http://anubis.dkuug.dk/jtc1/sc22/open/n2356/ /Per W On Wed, 5 Mar 2003, Per Westermark wrote: > The next step of from the 32-bit case statement below would be to use a > hash table. > > However, how would you replace the switch statement with std::bitset? > > /Per W > > On Wed, 5 Mar 2003, Ioannis Vranos wrote: > > > -------Original Message------- > > > > From: Per Westermark > > Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 12:26:51 =F0= =EC > > To: Giligun > > Cc: C++ > > Subject: Re: [Dev-C++] Character variables > > > > short s =3D 'ab'; > > int i =3D 'abcd'; > > > > given that int is 4 byte. > > > > > > =3D=3D> That isn't valid C++. And where it gets compiled you can't cons= ider it > > as safe. > > > > > > > > But a lot of compilers will give you warnings, since it you can't be su= re > > if memcpy(buf,&s,sizeof(s)) will give you > > buf[0] =3D 'a', buf[1] =3D 'b'; > > or > > buf[0] =3D 'b', buf[1] =3D 'a'; > > > > In short - be very careful about using this feature. One place where it= 's > > elegant to use is if you are reading a tagged file, where each tag is > > 4-byte long: > > char *buf; > > > > int tag =3D 0; > > for (i =3D 0; i < 4; i++) { > > tag =3D (tag << 8) | *buf++; > > } > > > > > > =3D=3D> Too system dependent. Why don't you use wchar_t instead? But si= nce he > > wants to store characters (assuming in the range 0-127) he can use a ch= ar > > sequence nicely and easily. > > > > switch (tag) { > > case 'STRT': ...; break; > > case 'HEDR': ...; break; > > case 'DATA': ...; break; > > case 'ENDF': ...; break; > > } > > > > If there are a lot of tags, the result is a very fast matching of the > > tags. > > > > > > =3D=3D> By the way i would do something like the above using std::bitse= t. > > > > > > > > Ioannis Vranos > > > > * Programming pages: http://www.noicys.freeurl.com > > * Alternative URL: http://run.to/noicys > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The debugg= er > for complex code. Debugging C/C++ programs can leave you feeling lost and > disoriented. TotalView can help you find your way. Available on major UNI= X > and Linux platforms. Try it free. www.etnus.com > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Per W. <pw...@ia...> - 2003-03-05 07:40:31
|
The next step of from the 32-bit case statement below would be to use a
hash table.
However, how would you replace the switch statement with std::bitset?
/Per W
On Wed, 5 Mar 2003, Ioannis Vranos wrote:
> -------Original Message-------
>
> From: Per Westermark
> Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 12:26:51 =F0=EC
> To: Giligun
> Cc: C++
> Subject: Re: [Dev-C++] Character variables
>
> short s =3D 'ab';
> int i =3D 'abcd';
>
> given that int is 4 byte.
>
>
> =3D=3D> That isn't valid C++. And where it gets compiled you can't consid=
er it
> as safe.
>
>
>
> But a lot of compilers will give you warnings, since it you can't be sure
> if memcpy(buf,&s,sizeof(s)) will give you
> buf[0] =3D 'a', buf[1] =3D 'b';
> or
> buf[0] =3D 'b', buf[1] =3D 'a';
>
> In short - be very careful about using this feature. One place where it's
> elegant to use is if you are reading a tagged file, where each tag is
> 4-byte long:
> char *buf;
>
> int tag =3D 0;
> for (i =3D 0; i < 4; i++) {
> tag =3D (tag << 8) | *buf++;
> }
>
>
> =3D=3D> Too system dependent. Why don't you use wchar_t instead? But sinc=
e he
> wants to store characters (assuming in the range 0-127) he can use a char
> sequence nicely and easily.
>
> switch (tag) {
> case 'STRT': ...; break;
> case 'HEDR': ...; break;
> case 'DATA': ...; break;
> case 'ENDF': ...; break;
> }
>
> If there are a lot of tags, the result is a very fast matching of the
> tags.
>
>
> =3D=3D> By the way i would do something like the above using std::bitset.
>
>
>
> Ioannis Vranos
>
> * Programming pages: http://www.noicys.freeurl.com
> * Alternative URL: http://run.to/noicys
|
|
From: Terry L F. <tf...@sm...> - 2003-03-05 00:46:39
|
Tuesday, March 4, 2003 you wrote: RC> I need a piece of code to read the CPU serial number or the Network adapter RC> serial number. Any one who can help? I had just seen a reference on a p3 serial number http://www.gamasutra.com/features/wyatts_world/19990528/pentium3_07.htm but not sure it will help you |