dev-cpp-users Mailing List for Dev-C++ (Page 315)
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: Michael D. S. <for...@hi...> - 2003-09-23 14:56:23
|
Prints little endian. I have no idea why :)
ms
At 06:03 AM 9/23/03, you wrote:
> > I have an AMD processor and no idea if it's big or little endian.
>
>main() {
> int x = 1;
> if (*(char *)&x == 1) {
> printf("little-endian\n");
> } else {
> printf("big-endian\n");
> }
>}
>
>
>Regards,
> Neszt Tibor
|
|
From: stefan k. <ste...@ya...> - 2003-09-23 14:49:10
|
Just type this:
typedef template class GenericIterator<T> BasicIterator;
That should work.
Cheers,
Stefan
Marcos Cesar Carrard wrote:
> Hello!
>
> I have a problem with a c++ library that I'm developing.I have one class to
> define a generic container and another class to a generic iterator, like this:
>
> template <class T> class GenericIterator{
> .....
> };
>
> template <class T> class GenericContainer{
> ....
> typedef GenericIterator<T> BasicIterator;
> ....
> };
>
> When this code is compiled, there was several warnings messages in the typedef
> inside of container class and in that locals where I use BasicIterator. The
> warnings are like "implicit typename is deprecated, see documentation".
>
> However, I need this type definition to allow a iterator declaration through the
> container class, like:
>
> int main()
> {
> Container<int> c;
> Container<int>::BasicIterator i;
> ....
> }
>
> How can I do to make this without error and/or warnings messages?
>
> Thanks,
>
> Marcos
>
>
>
> -------------------------------------------------------
> 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://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Marcos C. C. <ca...@in...> - 2003-09-23 14:32:13
|
Hello!
I have a problem with a c++ library that I'm developing.I have one class to
define a generic container and another class to a generic iterator, like this:
template <class T> class GenericIterator{
.....
};
template <class T> class GenericContainer{
....
typedef GenericIterator<T> BasicIterator;
....
};
When this code is compiled, there was several warnings messages in the typedef
inside of container class and in that locals where I use BasicIterator. The
warnings are like "implicit typename is deprecated, see documentation".
However, I need this type definition to allow a iterator declaration through the
container class, like:
int main()
{
Container<int> c;
Container<int>::BasicIterator i;
....
}
How can I do to make this without error and/or warnings messages?
Thanks,
Marcos
|
|
From: Per W. <pw...@ia...> - 2003-09-23 11:15:35
|
The AMD is same as Intel, or it wouldn't run x86 code.
/Per W
On Tue, 23 Sep 2003, Neszt Tibor wrote:
> > I have an AMD processor and no idea if it's big or little endian.
>
> main() {
> int x = 1;
> if (*(char *)&x == 1) {
> printf("little-endian\n");
> } else {
> printf("big-endian\n");
> }
> }
>
>
> Regards,
> Neszt Tibor
>
>
>
> -------------------------------------------------------
> 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://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Neszt T. <ne...@ss...> - 2003-09-23 11:06:02
|
> I have an AMD processor and no idea if it's big or little endian.
main() {
int x = 1;
if (*(char *)&x == 1) {
printf("little-endian\n");
} else {
printf("big-endian\n");
}
}
Regards,
Neszt Tibor
|
|
From: Per W. <pw...@ia...> - 2003-09-23 09:06:53
|
Since we are talking about << and >> for shifting bits, I still assume
we are talkinga bout integer arithmetic and not floating point. In that
case * and / won't involve any fp unit.
Anyway - the shift operators are very much wanted now too. It is simpler
to use them that to try and fiddle around with mult/div when you work with
bit manipulation. Yes, it is possible to remove | & ~ ^ << and >> but
manipulation of bit flags wouldn't directly become simpler.
// with bit manipulation
void process_alarms(unsigned alarms) {
unsigned flag = 1;
while (alarms) {
if (alarms & flag) {
cout << "processing alarm " << flag << "\n";
alarms &= ~flag;
}
flag <<= 1;
}
}
// without bit manipulation
void process_alarms(unsigned alarms) {
unsigned mask = 2;
while (alarms) {
mod = alarms % mask;
if (mod) {
cout << "processing alarm " << mod << "\n";
alarms -= mod;
}
mask *= 2;
}
}
/Per W
On Tue, 23 Sep 2003, Michael D. Smith wrote:
>
> OK, with that "slight*" correction. It does multiply and divide by 4 (using
> a 2), and as long as it's small numbers, and not negative numbers, it
> appears to work reliably both ways and back and forth.
>
> 30 or 40 years ago, when computers were a lot slower and had almost no
> memory, using this might have made sense. With a gigahertz computer, you're
> probably much better off to just stick with the regular math functions. If
> they are any slower, it's not by any noticeable amount, they are definitely
> more portable, and much less error prone -- programmer, maintainer, and
> otherwise (the dropped bits).
>
> I'm not real sure that when you engage the math processor to multiply or
> divide by 2,4,8,16 ect, that it doesn't just do this anyway -- only in a
> more portable/reliable fashion.
>
> Bottom line what's the point???
>
> It is fun to play with though. Think about being able to control one little
> bit in hundreds of millions of bytes -- now all I gotta do is figure out
> which one, and what I'm gonna do with the rest of 'em :)
>
> ms
>
>
> * just the difference between working and not working
>
>
>
> No wraparound, they drop off the end, at least on any machine I've ever
> been familiar with.
>
> I thought I would try, see how it works on this machine and got nothing. No
> compiler error, and no change in the int.
>
> Anyone know why this produces nothing (16) every time? And I tried other
> numbers, in both positions, as well. Even tried turning it around -- Same
> thing, nothing, every time. It seems there should be some effect, or an error..
>
> I have an AMD processor and no idea if it's big or little endian.
>
>
>
> #include<iostream.h>
> #include<stdlib.h>
> #include<fstream.h>
>
> int main()
> {
> int count = 16;
>
> count = count >> 2;
> cout << "count = " << count << "\n";
>
> count = count << 2;
> cout << "count = " << count << "\n";
>
> system ("pause");
> return 0;
> }
>
>
> At 08:14 PM 9/22/03, you wrote:
> >Hi there.
> >
> >Are the shift operators ( << and >> ) portable?
> >i.e.
> >Does x << 1 have the same effect as multiplying by 2 ?
> >and
> >Does x >> 1 have the same effect as dividing by 2?
> >On both big and little endian order machines?
> >
> >also is there any wraparound?
> >i.e. in a shift the bits that are pushed out of the data structure placed
> >at the back-end of the data structure (on the other side of where they
> >were pushed out)?
> >
> >Thanks in Advance
> >David McKen
> >
> >
> >Do you Yahoo!?
> ><http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com>Yahoo!
> >SiteBuilder - Free, easy-to-use web site design software
>
>
>
> -------------------------------------------------------
> 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://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
>
>
> -------------------------------------------------------
> 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://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: stefan k. <ste...@ya...> - 2003-09-23 08:19:51
|
Something to keep in mind about this matter:
You probably do not have to explicitly use the >> or << operators, since
most modern compilers will optimize the code to use shifts where
possible anyway.
Of course that only works, if the divisor or multiplicator is a constant
and the division / multiplication can be performed by using a single
shift instruction. (i.e. 2/4/8/16/...)
So instead of writing:
const long kFactor = 2;
value = foo << kFactor;
You can as well simply write:
const long kFactor = 4;
value = foo * kFactor;
Which will result in a left-shift by 2, effectively. (With most C/C++
compilers today.)
The *big advantage* of this is, that you can later easily change
'kFactor' to three 3 (if that should become necessary), without having
to find and change all your shifts back to multiplications in your code!
Cheers,
Stefan
Michael D. Smith wrote:
>
> OK, with that "slight*" correction. It does multiply and divide by 4
> (using a 2), and as long as it's small numbers, and not negative
> numbers, it appears to work reliably both ways and back and forth.
>
> 30 or 40 years ago, when computers were a lot slower and had almost no
> memory, using this might have made sense. With a gigahertz computer,
> you're probably much better off to just stick with the regular math
> functions. If they are any slower, it's not by any noticeable amount,
> they are definitely more portable, and much less error prone --
> programmer, maintainer, and otherwise (the dropped bits).
>
> I'm not real sure that when you engage the math processor to multiply or
> divide by 2,4,8,16 ect, that it doesn't just do this anyway -- only in a
> more portable/reliable fashion.
>
> Bottom line what's the point???
>
> It is fun to play with though. Think about being able to control one
> little bit in hundreds of millions of bytes -- now all I gotta do is
> figure out which one, and what I'm gonna do with the rest of 'em :)
>
> ms
>
>
> * just the difference between working and not working
>
>
>
> No wraparound, they drop off the end, at least on any machine I've ever
> been familiar with.
>
> I thought I would try, see how it works on this machine and got nothing.
> No compiler error, and no change in the int.
>
> Anyone know why this produces nothing (16) every time? And I tried other
> numbers, in both positions, as well. Even tried turning it around --
> Same thing, nothing, every time. It seems there should be some effect,
> or an error..
>
> I have an AMD processor and no idea if it's big or little endian.
>
>
>
> #include<iostream.h>
> #include<stdlib.h>
> #include<fstream.h>
>
> int main()
> {
> int count = 16;
>
> count = count >> 2;
> cout << "count = " << count << "\n";
>
> count = count << 2;
> cout << "count = " << count << "\n";
>
> system ("pause");
> return 0;
> }
>
>
> At 08:14 PM 9/22/03, you wrote:
>
>> Hi there.
>>
>> Are the shift operators ( << and >> ) portable?
>> i.e.
>> Does x << 1 have the same effect as multiplying by 2 ?
>> and
>> Does x >> 1 have the same effect as dividing by 2?
>> On both big and little endian order machines?
>>
>> also is there any wraparound?
>> i.e. in a shift the bits that are pushed out of the data structure
>> placed at the back-end of the data structure (on the other side of
>> where they were pushed out)?
>>
>> Thanks in Advance
>> David McKen
>>
>>
>> Do you Yahoo!?
>> <http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com>Yahoo!
>> SiteBuilder - Free, easy-to-use web site design software
>
>
>
>
> -------------------------------------------------------
> 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://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
>
>
> -------------------------------------------------------
> 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://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Michael D. S. <for...@hi...> - 2003-09-23 07:54:40
|
OK, with that "slight*" correction. It does multiply and divide by 4 (using
a 2), and as long as it's small numbers, and not negative numbers, it
appears to work reliably both ways and back and forth.
30 or 40 years ago, when computers were a lot slower and had almost no
memory, using this might have made sense. With a gigahertz computer, you're
probably much better off to just stick with the regular math functions. If
they are any slower, it's not by any noticeable amount, they are definitely
more portable, and much less error prone -- programmer, maintainer, and
otherwise (the dropped bits).
I'm not real sure that when you engage the math processor to multiply or
divide by 2,4,8,16 ect, that it doesn't just do this anyway -- only in a
more portable/reliable fashion.
Bottom line what's the point???
It is fun to play with though. Think about being able to control one little
bit in hundreds of millions of bytes -- now all I gotta do is figure out
which one, and what I'm gonna do with the rest of 'em :)
ms
* just the difference between working and not working
No wraparound, they drop off the end, at least on any machine I've ever
been familiar with.
I thought I would try, see how it works on this machine and got nothing. No
compiler error, and no change in the int.
Anyone know why this produces nothing (16) every time? And I tried other
numbers, in both positions, as well. Even tried turning it around -- Same
thing, nothing, every time. It seems there should be some effect, or an error..
I have an AMD processor and no idea if it's big or little endian.
#include<iostream.h>
#include<stdlib.h>
#include<fstream.h>
int main()
{
int count = 16;
count = count >> 2;
cout << "count = " << count << "\n";
count = count << 2;
cout << "count = " << count << "\n";
system ("pause");
return 0;
}
At 08:14 PM 9/22/03, you wrote:
>Hi there.
>
>Are the shift operators ( << and >> ) portable?
>i.e.
>Does x << 1 have the same effect as multiplying by 2 ?
>and
>Does x >> 1 have the same effect as dividing by 2?
>On both big and little endian order machines?
>
>also is there any wraparound?
>i.e. in a shift the bits that are pushed out of the data structure placed
>at the back-end of the data structure (on the other side of where they
>were pushed out)?
>
>Thanks in Advance
>David McKen
>
>
>Do you Yahoo!?
><http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com>Yahoo!
>SiteBuilder - Free, easy-to-use web site design software
-------------------------------------------------------
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://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: Moses F. <fan...@ho...> - 2003-09-23 07:15:56
|
Hi, My name is Moses Fanai.I have just begun to write programes on C++.Id really appreciate it if you could tell me how to programe on winsocket(in C++).IS there any tool that could speed up the process.Thanks Moses _________________________________________________________________ Attention NRIs! Banking worries? http://server1.msn.co.in/msnspecials/nriservices/index.asp Get smart tips. |
|
From: Per W. <pw...@ia...> - 2003-09-23 06:12:51
|
Note that "\a" stands for 'attention' and is the beep character (ctrl-G)
which is the same as your "\07" character.
And yes it works. But isn't really a beep but a short ping.
/Per W
#include <stdio.h>
int main(void) {
printf("\a"); /* emit first beep */
printf("\07"); /* emit second beep */
return 0;
}
On Mon, 22 Sep 2003, William Mc Coy wrote:
> Hi Guy's.
>
> I'm new to 'C' (NEWBIE). My question! Has anybody ever gotten the "BEEP" function to work in a console program?
>
> Both of the books I'm reading, state by using the '\07' parameter in a printf function will ring the system Bell.
>
> I'v tried using DEV-C++ (GCC) & also the WIN32 compilers, with no results. My OS is XP home edition.
>
> Thanks.
> Everyone have a nice day.
>
> William
>
|
|
From: Brion K. <bri...@bi...> - 2003-09-23 06:10:36
|
#include <iostream>
using std::cout;
int main (void)
{
cout << "\t\07\nhere comes the bell\n\n";
system("PAUSE");
return(0);
}
Hi William, This works for me.
Brion
----- Original Message -----
From: William Mc Coy
To: dev...@li...
Sent: Tuesday, September 23, 2003 8:21 AM
Subject: [Dev-C++] Re: Ring Bell (BEEP)
Hi Guy's.
I'm new to 'C' (NEWBIE). My question! Has anybody ever gotten the "BEEP"
function to work in a console program?
Both of the books I'm reading, state by using the '\07' parameter in a
printf function will ring the system Bell.
I'v tried using DEV-C++ (GCC) & also the WIN32 compilers, with no results.
My OS is XP home edition.
Thanks.
Everyone have a nice day.
William
|
|
From: Per W. <pw...@ia...> - 2003-09-23 06:07:04
|
They don't wrap around since they are shift operators and not rotate
operators.
Some care should be used with negative numbers since most machines are
using two-complement numbers which high bit specifies if number is
negative. By shifting that bit, you definitely don't get mult/div with
two.
As long as you don't try to load only a part of a number and perform a
shift on, big or little endian doesn't matter. The endianness is only how
the number is stored in memory. When loaded into the processor, it is just
a number.
Big or little endian doesn't matter - unless a number is processed
The sample program below doesn't work becase it isn't assigning the result
of the shifts.
count <<= 1;
count >>= 1;
or
count = count << 1;
count = count >> 1;
/Per W
On Mon, 22 Sep 2003, Michael D. Smith wrote:
>
> No wraparound, they drop off the end, at least on any machine I've ever
> been familiar with.
>
> I thought I would try, see how it works on this machine and got nothing. No
> compiler error, and no change in the int.
>
> Anyone know why this produces nothing (16) every time? And I tried other
> numbers, in both positions, as well. Even tried turning it around -- Same
> thing, nothing, every time. It seems there should be some effect, or an
> error..
>
> I have an AMD processor and no idea if it's big or little endian.
>
>
>
> #include<iostream.h>
> #include<stdlib.h>
> #include<fstream.h>
>
> int main()
> {
> int count = 16;
>
> count >> 2;
> cout << "count = " << count << "\n";
>
> 2 << count;
> cout << "count = " << count << "\n";
>
> system ("pause");
> return 0;
> }
>
>
> At 08:14 PM 9/22/03, you wrote:
> >Hi there.
> >
> >Are the shift operators ( << and >> ) portable?
> >i.e.
> >Does x << 1 have the same effect as multiplying by 2 ?
> >and
> >Does x >> 1 have the same effect as dividing by 2?
> >On both big and little endian order machines?
> >
> >also is there any wraparound?
> >i.e. in a shift the bits that are pushed out of the data structure placed
> >at the back-end of the data structure (on the other side of where they
> >were pushed out)?
> >
> >Thanks in Advance
> >David McKen
> >
> >
> >Do you Yahoo!?
> ><http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com>Yahoo!
> >SiteBuilder - Free, easy-to-use web site design software
>
>
>
> -------------------------------------------------------
> 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://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Michael D. S. <for...@hi...> - 2003-09-23 04:37:54
|
No wraparound, they drop off the end, at least on any machine I've ever
been familiar with.
I thought I would try, see how it works on this machine and got nothing. No
compiler error, and no change in the int.
Anyone know why this produces nothing (16) every time? And I tried other
numbers, in both positions, as well. Even tried turning it around -- Same
thing, nothing, every time. It seems there should be some effect, or an
error..
I have an AMD processor and no idea if it's big or little endian.
#include<iostream.h>
#include<stdlib.h>
#include<fstream.h>
int main()
{
int count = 16;
count >> 2;
cout << "count = " << count << "\n";
2 << count;
cout << "count = " << count << "\n";
system ("pause");
return 0;
}
At 08:14 PM 9/22/03, you wrote:
>Hi there.
>
>Are the shift operators ( << and >> ) portable?
>i.e.
>Does x << 1 have the same effect as multiplying by 2 ?
>and
>Does x >> 1 have the same effect as dividing by 2?
>On both big and little endian order machines?
>
>also is there any wraparound?
>i.e. in a shift the bits that are pushed out of the data structure placed
>at the back-end of the data structure (on the other side of where they
>were pushed out)?
>
>Thanks in Advance
>David McKen
>
>
>Do you Yahoo!?
><http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com>Yahoo!
>SiteBuilder - Free, easy-to-use web site design software
|
|
From: David M. <ci...@ya...> - 2003-09-23 01:14:57
|
Hi there. Are the shift operators ( << and >> ) portable? i.e. Does x << 1 have the same effect as multiplying by 2 ? and Does x >> 1 have the same effect as dividing by 2? On both big and little endian order machines? also is there any wraparound? i.e. in a shift the bits that are pushed out of the data structure placed at the back-end of the data structure (on the other side of where they were pushed out)? Thanks in Advance David McKen --------------------------------- Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software |
|
From: William Mc C. <WIL...@ms...> - 2003-09-22 22:22:04
|
Hi Guy's.
I'm new to 'C' (NEWBIE). My question! Has anybody ever gotten the "BEEP" =
function to work in a console program?
Both of the books I'm reading, state by using the '\07' parameter in a =
printf function will ring the system Bell.
I'v tried using DEV-C++ (GCC) & also the WIN32 compilers, with no =
results. My OS is XP home edition.
Thanks.=20
Everyone have a nice day.=20
William =20
|
|
From: Ed C. <em...@ed...> - 2003-09-22 21:57:27
|
[EMC] (This was Pascal's message, but I think most people ignored the = French version, so I'm reposting the English one) =20 ************************************************* Hello, I'm starting to program, or at least to compile program source codes for DirectX 9, and I would like to know how to use correctly source codes developped in VC++, because the import method doesn't really work well, = or I have done [lit. seized] something incorrectly. Also, how to use libraries (.lib) directly under Dev-C++, because I've noticed a difference between the libraries for DirectX 9 created by = Dev-C++ and those by the MS SDK. Or, [tell me] how to convert a .lib library to = a .a. ************************************************ I don't know how to answer him, though, so I'll leave the response to others. |
|
From: <or...@vp...> - 2003-09-22 19:43:06
|
Prathmesh Mahidharia wrote: > Hi there, > I m trying to compile and run an opengl source code in Dev c++, but it > does not compile. I m using glut commands. But every time I run it gives me > linker error undefined reference to glut commands. I included all the libs > in the linker box, but still it gives all the probs. Can anybody plz suggest > a solution here? Also, what type of project should i select if i need to > build an opengl program? Wind32 or console application? and in each opengl > program, do i need to include "#inlcude<windows.h>"? If i do, then it does > not remain platform compatible any more, meaning i cant run it on linux then > and opengl was meant to be platform independent. Plz help. Can you post us the errors you get, the project file of your project, the sources, code snippets, anything that can be examined? That would be very useful! -- Greetings, Balázs |
|
From: Prathmesh M. <P.M...@mu...> - 2003-09-22 07:16:31
|
Hi there, I m trying to compile and run an opengl source code in Dev c++, but it does not compile. I m using glut commands. But every time I run it gives me linker error undefined reference to glut commands. I included all the libs in the linker box, but still it gives all the probs. Can anybody plz suggest a solution here? Also, what type of project should i select if i need to build an opengl program? Wind32 or console application? and in each opengl program, do i need to include "#inlcude<windows.h>"? If i do, then it does not remain platform compatible any more, meaning i cant run it on linux then and opengl was meant to be platform independent. Plz help. |
|
From: Per W. <pw...@ia...> - 2003-09-22 06:19:29
|
Declaring a static variable inside the implementation of a class method is
identical to declaring it inside a normal function, so - if I remember my
original numbering - it is my 2nd example.
I just wanted to display the different uses of static - for file-wide
variable, inside a function/method, and inside a class definition.
/Per W
On Mon, 22 Sep 2003, Oladipo Odumosu wrote:
>
> yo /Per,
>
> 4give me if i'm wrong, but i thought item 4 was for those variables which=
are *declared **in** the class* , not in functions belonging to the class.=
if my memory serves me right, the query was about
>
> class test
>
> {
>
> public:
>
> void f();
>
> }
>
>
>
> void test::f()
>
> {
>
> static int cow =3D 0;
>
> cow++; std::cout << cow << std::endl;
>
> }
>
> or something likewise. if some1 will take Confucius away, i'll gladly get=
back to my TCPL :D.
>
>
> ---------------------------------
> Want to chat instantly with your online friends?=A0Get the FREE Yahoo!Mes=
senger
|
|
From: <gen...@ya...> - 2003-09-22 03:59:09
|
yo /Per,
4give me if i'm wrong, but i thought item 4 was for those variables which are *declared **in** the class* , not in functions belonging to the class. if my memory serves me right, the query was about
class test
{
public:
void f();
}
void test::f()
{
static int cow = 0;
cow++; std::cout << cow << std::endl;
}
or something likewise. if some1 will take Confucius away, i'll gladly get back to my TCPL :D.
---------------------------------
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger |
|
From: Per W. <pw...@ia...> - 2003-09-21 22:19:09
|
Half a million entries of int is 2MB.
The fist alternative isn't static - it isn't a global variable - but is
auto, i.e. stored on the stack. The stack isn't infinite, and should not
be used for huge allocations.
Because of the limitations in a 32-bit environment - max 4GB address space
- most OS limits the max stack size to a couple of MB, and try to keep as
large part of the address space available for dynamic allocation,
memory-mapped files, interprocess communication etc.
/Per W
On Sun, 21 Sep 2003, Alessandro Bugatti wrote:
> Why when I try to run the following program
>
> int main()
> {
> int a[1000000];
> system("PAUSE");
> return 0;
> }
>
> I have a fatal error during execution (it seems to happen when the array is over 500000)
> while the following program
>
> int main()
> {
> int *a;
> a=(int *)malloc(1000000);
> system("PAUSE");
> return 0;
> }
>
> works fine?
> In the first there is static allocation and in the second I use dynamic allocation, but the result should be the same (or not?)
> Thanks.
> Alessandro
|
|
From: Alessandro B. <al...@vi...> - 2003-09-21 21:46:27
|
Why when I try to run the following program
int main()
{
int a[1000000];
system("PAUSE");
return 0;
}
I have a fatal error during execution (it seems to happen when the array =
is over 500000)
while the following program
int main()
{
int *a;
a=3D(int *)malloc(1000000);
system("PAUSE");
return 0;
}
works fine?
In the first there is static allocation and in the second I use dynamic =
allocation, but the result should be the same (or not?)
Thanks.
Alessandro |
|
From: Per W. <pw...@ia...> - 2003-09-21 21:20:44
|
prj_info.input is a pointer to a pointer to char.
If you want to store 10 lines in it:
info.input = (char**)malloc(10*sizeof(char*));
info.input[0] = (char*)malloc(sizeof(char)*(strlen("mystr1")+1));
...
info.input[9] = (char*)malloc(sizeof(char)*(strlen("mystr10")+1));
strcpy(info.input[0],"mystr1");
...
strcpy(info.input[9],"mystr10");
Question: Don't you ever try to get the compiler to generate as many
warnings as possible, and then check up on the warnings?
The compiler would definitely become a bit worried when you do:
info.input = (char*)malloc(...);
since you are typecasting to the wrong type.
Take two steps back and think a bit about your code and what you want to
do. Check up on all data types, and exactly what you allocate.
That little realloc() line you have is very, very interesting. You are
reallocating the wrong thing - did you intend to reallocate the array
of pointers to text strings, or a specific string buffer in the array?
- and you are forgetting that the new pointer is the RETURN VALUE of the
realloc() call.
/Per W
On Sat, 20 Sep 2003, Matthews wrote:
> Still giving me the same crash :\
>
> At 11:32 AM 20/09/2003 +0200, Per Westermark wrote:
> >When you allocate buffers for strings, you must allocate room for
> >strlen(str)+1
> >characters, or the termination character '\0' will not fit.
> >
> >/Per W
> >
> >On Fri, 19 Sep 2003, Matthews wrote:
> >
> >> I'm working on a program to generate makefiles for me, and I currently have
> >> it set up to read different sections of a file to generate the options.
> >> One section is %input, which has a list of filenames to include, eg.
> >>
> >> prj.txt
> >>
> >> %input
> >> main.c
> >> vid.c
> >> gui.c
> >>
> >> I read these into a struct organized like so:
> >>
> >> struct prj_info
> >> {
> >> ...
> >> char **input;
> >> ...
> >> }
> >>
> >> And I allocate space based on how many files there are (an array of
> >> strings, basically)
> >>
> >> My problem is that I get errors when running the following C code:
> >>
> >> if(!strncmp("%include",t,strlen(t)-1))
> >> {
> >> count = 0;
> >> skip_line(buf);
> >> getword(buf,t);
> >> longest_length = strlen(t);
> >> info.input = (char *)malloc((sizeof(char)*longest_len)*1);
> >> if(!info.input)
> >> {
> >> printf("OH NOS\n");
> >> return 0;
> >> }
> >> //CRASH HERE
> >> strcpy(info.input[count],t);
> >> while(*buf!='%')
> >> {
> >> while(*buf=='#'||isspace(*buf)) skip_line(buf);
> >> getword(buf,t);
> >> if(strlen(t)>longest_length) longest_length = strlen(t);
> >> count++;
> >> realloc(info.input,(sizeof(char)*longest_length)*count);
> >> if(!info.input)
> >> {
> >> printf("ERR0RZ\n");
> >> return 0;
> >> }
> >> strcpy(info.input[count],t);
> >> skip_line(buf);
> >> }
> >> }
> >>
> >> Buf is the dumped contents of a file (like prj.txt), getword() places a
> >> word from buf into t and skip_line() skips to the next line in buf.
> >>
> >> The code compiles fine, but crashes at the first strcpy(). Any help would
> >> be appreciated.
> >>
> >>
> >> -------------------------------------------------------
> >> 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://www23.brinkster.com/noicys/devcpp/ub.htm
> >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >>
> >
> >
>
>
> -------------------------------------------------------
> 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://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Reid T. <rei...@at...> - 2003-09-21 15:39:21
|
why is longest_len being cast to a char * in sizeof? and where is
longest_len defined/set?
>> info.input = (char *)malloc((sizeof(char)*longest_len)*1);
Matthews wrote:
> Still giving me the same crash :\
>
> At 11:32 AM 20/09/2003 +0200, Per Westermark wrote:
> >When you allocate buffers for strings, you must allocate room for
> >strlen(str)+1
> >characters, or the termination character '\0' will not fit.
> >
> >/Per W
> >
> >On Fri, 19 Sep 2003, Matthews wrote:
> >
> >> I'm working on a program to generate makefiles for me, and I
> currently have
> >> it set up to read different sections of a file to generate the
> options.
> >> One section is %input, which has a list of filenames to include, eg.
> >>
> >> prj.txt
> >>
> >> %input
> >> main.c
> >> vid.c
> >> gui.c
> >>
> >> I read these into a struct organized like so:
> >>
> >> struct prj_info
> >> {
> >> ...
> >> char **input;
> >> ...
> >> }
> >>
> >> And I allocate space based on how many files there are (an array of
> >> strings, basically)
> >>
> >> My problem is that I get errors when running the following C code:
> >>
> >> if(!strncmp("%include",t,strlen(t)-1))
> >> {
> >> count = 0;
> >> skip_line(buf);
> >> getword(buf,t);
> >> longest_length = strlen(t);
> >> info.input = (char *)malloc((sizeof(char)*longest_len)*1);
> >> if(!info.input)
> >> {
> >> printf("OH NOS\n");
> >> return 0;
> >> }
> >> //CRASH HERE
> >> strcpy(info.input[count],t);
> >> while(*buf!='%')
> >> {
> >> while(*buf=='#'||isspace(*buf)) skip_line(buf);
> >> getword(buf,t);
> >> if(strlen(t)>longest_length) longest_length = strlen(t);
> >> count++;
> >> realloc(info.input,(sizeof(char)*longest_length)*count);
> >> if(!info.input)
> >> {
> >> printf("ERR0RZ\n");
> >> return 0;
> >> }
> >> strcpy(info.input[count],t);
> >> skip_line(buf);
> >> }
> >> }
> >>
> >> Buf is the dumped contents of a file (like prj.txt), getword()
> places a
> >> word from buf into t and skip_line() skips to the next line in buf.
> >>
> >> The code compiles fine, but crashes at the first strcpy(). Any
> help would
> >> be appreciated.
> >>
> >>
> >> -------------------------------------------------------
> >> 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://www23.brinkster.com/noicys/devcpp/ub.htm
> >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >>
> >
> >
>
>
> -------------------------------------------------------
> 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://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Pascal <p.t...@ti...> - 2003-09-21 12:48:27
|
Hello, I'm starting to program, or at least to compile program source codes for = DirectX 9, and I would like to know how to use correctly source codes = developped in VC++, because the import method doesn't really work well, = or I have done [lit. seized] something incorrectly. Also, how to use libraries (.lib) directly under Dev-C++, because I've = noticed a difference between the libraries for DirectX 9 created by = Dev-C++ and those by the MS SDK. Or, [tell me] how to convert a .lib = library to a .a. P.S. If there are no francophones on your list, tell me. I will try to = write in English. [Ce n'est pas un problem!] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.520 / Virus Database: 318 - Release Date: 18/09/2003 |