dev-cpp-users Mailing List for Dev-C++ (Page 420)
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: <cc...@ag...> - 2003-03-17 21:20:14
|
Hi Vincent,
semicolon at the end of the "for" it is the only instruction that belongs
to the "for", that is to say, is the only instruction that is executed
within the "for". The instructions that are between { and } form a block,
which is a valid construction in C/C++. so that the instructions between =
{
and } are executed like part of the "for", you must delete the semicolon
at the end of the "for".
for(i=3D1;i<=3D5;i++)
{
theta2 =3D theta2 + 30.0;
if(theta2 >=3D 90.0);
}
what is the intention of this if(theta2 >=3D 90.0); ?
nothing happend, true or false nothing happend.
Greetings.
> From: Vincent Ogwuagwu <ovo...@ya...>
> To: dev...@li...
> Subject: [Dev-C++] Looping Problem
>
> Please wrote a program that does a large number of
> calculations within a loop for each value of a real
> number that is used for the loop. However, when I
> compiled and ran the program, it only recognized the
> first value of the loop, while in the actual sense it
> is supposed to calculate for three values of the real
> number. Could someone let me know how to design the
> loop to recognize the other values. The loop is as
> shown below:
>
>
> for(i=3D1;i<=3D5;i++);
>
> {
>
> =93
> =93
> theta2 =3D theta2 + 30.0;
> if(theta2 >=3D 90.0);
> }
>
> The output (Print) statement is also within the loop.
>
> Thank you.
>
> Vincent.
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online
> http://webhosting.yahoo.com
>
--=20
Carlos Ch=E1vez
AG Software, S.A.
776-8344
267-3007
--=20
Carlos Ch=E1vez
AG Software, S.A.
776-8344
267-3007
|
|
From: <cc...@ag...> - 2003-03-17 21:16:05
|
Hi Vincent,
semicolon at the end of the "for" it is the only instruction that belongs
to the "for", that is to say, is the only instruction that is executed
within the "for". The instructions that are between { and } form a block,
which is a valid construction in C/C++. so that the instructions between =
{
and } are executed like part of the "for", you must delete the semicolon
at the end of the "for".
for(i=3D1;i<=3D5;i++)
{
theta2 =3D theta2 + 30.0;
if(theta2 >=3D 90.0);
}
what is the intention of this if(theta2 >=3D 90.0); ?
nothing happend, true or false nothing happend.
Greetings.
> From: Vincent Ogwuagwu <ovo...@ya...>
> To: dev...@li...
> Subject: [Dev-C++] Looping Problem
>
> Please wrote a program that does a large number of
> calculations within a loop for each value of a real
> number that is used for the loop. However, when I
> compiled and ran the program, it only recognized the
> first value of the loop, while in the actual sense it
> is supposed to calculate for three values of the real
> number. Could someone let me know how to design the
> loop to recognize the other values. The loop is as
> shown below:
>
>
> for(i=3D1;i<=3D5;i++);
>
> {
>
> =93
> =93
> theta2 =3D theta2 + 30.0;
> if(theta2 >=3D 90.0);
> }
>
> The output (Print) statement is also within the loop.
>
> Thank you.
>
> Vincent.
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online
> http://webhosting.yahoo.com
>
--=20
Carlos Ch=E1vez
AG Software, S.A.
776-8344
267-3007
|
|
From: Kevin L. <kla...@ya...> - 2003-03-17 16:17:14
|
Thanks Maurice, I had seen the article before and it is what I want to do. The author uses GDB to attach to a process. Since Dev-C++ is built over GDB it should be able to do the same thing. By attaching a running process I can switch back and forth between java and C++ IDEs. Does Dev-C++ pass commands to GDB much like a command line? Or does it call low level functions directly? If it is the first one then maybe I could modify the code to simply pass the "attach <PID>" to GDB. I don't relish the idea of building and modifying a large program for such a small change but I might do it when I had some free time. If it means learning a large complex interface than I will just use VC++. If anyone knows the answer to these questions I would appreciate any info. Thanks, Kevin > > > Here is an article on debugging a GNU DLL called from a java program :- > > http://www-106.ibm.com/developerworks/java/library/j-jnidebug/ > > > You can simply specify you exe in "execute->parameters" menu option in > Dev-C++ and compile DLL in debug and set a breakpoint > inside it. Should work ... in theory. > > > Maurice > --- Kevin Lahey <kla...@ya...> wrote: > Hello, > > I want to attach a dll to a running process so I can debug the dll. Can the > latest release do this? My understanding is that the debugger is built over > GDB which can certainly do it. > > Thank you, > Kevin > > __________________________________________________ > Do you Yahoo!? > Yahoo! Web Hosting - establish your business online > http://webhosting.yahoo.com > __________________________________________________ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com |
|
From: Daniel G. <sp...@ho...> - 2003-03-17 11:58:05
|
I think it's because you are painting within the WM_PAINT message.
WM_PAINT is triggered when something needs repainting, a window moving,
screen updates whatever - and if you are drawing within that message you
trigger another, another etc.
Remember to use BeginPaint and EndPaint function calls to sandwich your
drawing code.
I hope this helps, I'm a bit rusty with Windows.
>From: "Jorge Abramian" <jab...@ma...>
>Reply-To: <jab...@ma...>
>To: <dev...@li...>
>Subject: [Dev-C++] Resizing windows
>Date: Mon, 17 Mar 2003 06:47:59 -0500
>
>Hi, I am new here and this is my problem:
>
>1) I am developing a simple program to show some formatted data on the
>screen (ASCII X; Y).
>2) Everything is ok until I resize the screen, then it goes white.
>3) if I trap the WM_PAINT message and set UpdateWindow(), then the screen
>starts up gray.
>4) I tried to use within WM_PAINT, Beginpaint, Getclientrect, Fillrect, to
>bring back the whith color of the child window. But it didn't work.
>
>5) the data I need to show is:
>
>if(Number_of_Points!=0)
> {
> for (loop=0; loop<Number_of_Points; loop++)
> {
> sprintf (temp,"%6.2f",x[loop]);
> sprintf (temp2,"%6.2f",y[loop]);
> TextOut(hdc, 2,line,temp, 6);
> TextOut(hdc, 80, line,temp2,6);
> paintline+=13;
> }
> }
>
>
>Any clues? Example codes? tutorials? HELPP!!!!!!!! and then thanks.
>
>je
>
>
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by:Crypto Challenge is now open!
>Get cracking and register here for some mind boggling fun and
>the chance of winning an Apple iPod:
>http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
>_______________________________________________
>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
_________________________________________________________________
MSN Messenger - fast, easy and FREE! http://messenger.msn.co.uk
|
|
From: Jorge A. <jab...@ma...> - 2003-03-17 11:48:06
|
Hi, I am new here and this is my problem:
1) I am developing a simple program to show some formatted data on the screen (ASCII X; Y).
2) Everything is ok until I resize the screen, then it goes white.
3) if I trap the WM_PAINT message and set UpdateWindow(), then the screen starts up gray.
4) I tried to use within WM_PAINT, Beginpaint, Getclientrect, Fillrect, to bring back the whith color of the child window. But it didn't work.
5) the data I need to show is:
if(Number_of_Points!=0)
{
for (loop=0; loop<Number_of_Points; loop++)
{
sprintf (temp,"%6.2f",x[loop]);
sprintf (temp2,"%6.2f",y[loop]);
TextOut(hdc, 2,line,temp, 6);
TextOut(hdc, 80, line,temp2,6);
paintline+=13;
}
}
Any clues? Example codes? tutorials? HELPP!!!!!!!! and then thanks.
je
|
|
From: Per W. <pw...@ia...> - 2003-03-17 11:31:54
|
See below
/PWM
On Mon, 17 Mar 2003, Vincent Ogwuagwu wrote:
> Please wrote a program that does a large number of
> calculations within a loop for each value of a real
> number that is used for the loop. However, when I
> compiled and ran the program, it only recognized the
> first value of the loop, while in the actual sense it
> is supposed to calculate for three values of the real
> number. Could someone let me know how to design the
> loop to recognize the other values. The loop is as
> shown below:
>
>
> for(i=3D1;i<=3D5;i++);
Your loop both starts and stops at this single line, because you end it
with the semicolon...
>
> {
>
> =93
> =93
> theta2 =3D theta2 + 30.0;
> if(theta2 >=3D 90.0);
What use is an if statement without any following action?
Besides, never, never test for equality when working with floating point
numbers. Round-off errors might bite real hard.
if (theta2 > 91.0) do_something();
or
if (theta2 > (90.0 + eps)) do_something();
> }
>
> The output (Print) statement is also within the loop.
>
> Thank you.
>
> Vincent.
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online
> http://webhosting.yahoo.com
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by:Crypto Challenge is now open!
> Get cracking and register here for some mind boggling fun and
> the chance of winning an Apple iPod:
> http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> _______________________________________________
> 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-17 11:23:51
|
why not just post the error messages and the sections of code they relate to? 200kb is a lot for those of us with limited storage space. >From: "Dany P. Wu" <da...@qu...> >To: <dev...@li...> >Subject: [Dev-C++] A question about my first OOP codes >Date: Mon, 17 Mar 2003 22:33:52 +1200 > >Hi everyone, > >I just got back into my course after being away for a month. I was given >this silly program to look at and compile at home. It was written in the >.NET environment but from what I could see it didn't see any reason why >it wouldn't compile under GNU CPP. > >Not knowing the exact etiquette of this list I wasn't going to post the >200 KB zip file containing the codes. Is it okay if I post that here for >someone to look at? > >Cheers, >Dany. > > >-- >This mail is a natural product. The slight variations in >spelling and grammar enhance its individual character and >beauty and in no way are to be considered flaws or defects. > > > >------------------------------------------------------- >This SF.net email is sponsored by:Crypto Challenge is now open! >Get cracking and register here for some mind boggling fun and >the chance of winning an Apple iPod: >http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en >_______________________________________________ >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 _________________________________________________________________ Chat online in real time with MSN Messenger http://messenger.msn.co.uk |
|
From: Ioannis V. <iv...@em...> - 2003-03-17 11:08:52
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of anele Ngcobo > Sent: Monday, March 17, 2003 11:50 AM > To: dev...@li... > Subject: [Dev-C++] 'help' > > > Hello.... > > if youd be do kind as to unsubscribe me,i would highly > apprecciate that. > > thank you [ ... ] > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |
|
From: Vincent O. <ovo...@ya...> - 2003-03-17 10:57:49
|
Please wrote a program that does a large number of
calculations within a loop for each value of a real
number that is used for the loop. However, when I
compiled and ran the program, it only recognized the
first value of the loop, while in the actual sense it
is supposed to calculate for three values of the real
number. Could someone let me know how to design the
loop to recognize the other values. The loop is as
shown below:
for(i=1;i<=5;i++);
{
theta2 = theta2 + 30.0;
if(theta2 >= 90.0);
}
The output (Print) statement is also within the loop.
Thank you.
Vincent.
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com
|
|
From: Dany P. W. <da...@qu...> - 2003-03-17 10:32:56
|
Hi everyone, I just got back into my course after being away for a month. I was given this silly program to look at and compile at home. It was written in the .NET environment but from what I could see it didn't see any reason why it wouldn't compile under GNU CPP. Not knowing the exact etiquette of this list I wasn't going to post the 200 KB zip file containing the codes. Is it okay if I post that here for someone to look at? Cheers, Dany. -- This mail is a natural product. The slight variations in spelling and grammar enhance its individual character and beauty and in no way are to be considered flaws or defects. |
|
From: anele N. <an...@an...> - 2003-03-17 09:50:38
|
Hello.... if youd be do kind as to unsubscribe me,i would highly apprecciate that. thank you == Download ringtones, logos and picture messages at Ananzi Mobile Fun. http://www.ananzi.co.za/cgi-bin/goto.pl?mobile |
|
From: anele N. <an...@an...> - 2003-03-17 09:42:45
|
|
From: Koen P. <koe...@ho...> - 2003-03-16 08:03:23
|
Hi everyone
I'm writing a win32 program and it compiled well, but then suddenly when =
i tried to run it it said :=20
"Error while starting program
The file [filename] is damaged
Re=EFnstall the program and try again."
What can be done with it ??
Koen
Using:
Windows ME=20
Dev-C++ 4 build on 21/09/2000 23:22:34 |
|
From: Ioannis V. <iv...@em...> - 2003-03-15 23:31:02
|
-----------------------Original Message-----------------------
>From: Andr=E9 Mac=E1rio Barros [mailto:and...@su...]
>To: Dev-Cpp-Users [mailto:dev...@li...]
>Date: 14/3/2003 3:31:00 =F0=EC
>Subject: [Dev-C++] Correct use of pointers
>
>Gentlemen,
>
> Even in the Ritchie=B4s books sometimes I fount .C codes using "wild
>pointers" or something
>like:
>****************
>void main()
=20
int main()
>{
> int *p, a, b;
>
> a=3D2;
> b=3D3;
> *p =3D a + b;
>
> ...
>}
>****************
The above is a mistake. I do not recall something like that in K&R2. Are
you sure it is not written something like this?:
int p[10], a, b;
a=3D2;
b=3D3;
*p=3Da+b;
>But... in large programs we can have problems.
>
> Would I be corret, allways, if I use insted a code like:
>*********************
>#include <stdlib.h> /* or alloc.h */
>
>void main()
>{
> int *p, a, b;
>
> p=3Dmalloc(1*sizeof(int));
> a=3D2;
> b=3D3;
> *p =3D a + b;
> ...
> free(p);
>}
>******************
>1. It=B4s not necessary, but is it tecnically correct?
It is correct and required. malloc() could be used like this:
p=3Dmalloc(sizeof(int));
or
p=3Dmalloc(sizeof(*p));
>2. Is there any point, where the previous memory allocation is mandatory=
?
=20
ALWAYS.
Ioannis Vranos=20
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL: http://run.to/noicys=20
|
|
From: <and...@su...> - 2003-03-15 23:21:58
|
Thank you, Mr PW,
It´s because I´m teaching and I would like to create some procedural
behavior
in the student minds when using pointers.
I´m trying to show them that pointers are not alive creatures that enter
inside
the computers and crash them.
Yes, a single integer would not create memory problems... :-))
But if I fix in their minds that every time they use pointers, using the
malloc/free procedure, they can make almost everything with pointers.
NOTE: yes, you´re right completly I would need
if(!(p=(int *)malloc(1*sizeof(int))))
{
printf("no space...sorry);
exit(1);
}
... rest of the code
Regards
Andre
-----Mensagem original-----
De: Per Westermark [mailto:pw...@ia...]
Enviada em: sábado, 15 de março de 2003 20:02
Para: André Macário Barros
Cc: Dev-Cpp-Users
Assunto: Re: [Dev-C++] Correct use of pointers II
Yes, it's technically correct, but normally when allocating memory you
should check that the allocattion succeeded, i.e. that p wasn't set to
NULL.
On the other hand, malloc/free are extremely expensive, and I can't really
se why anyone would need to allocate a single integer. Since the integer
often have the same size as the pointer, while the memory allocation
library will need to keep some book-keeping information for each
allocation, it's a very strange thing to do.
Since you need one pointer for every int* you allocate, you might use
integers directly instead, and save a huge amount of time and memory.
If you don't need how many elements you need to sture until the program is
run, it's still no use to allocate single integers. Allocate an array of
integers instead.
/Per W
On Sat, 15 Mar 2003, André Macário Barros wrote:
> Gentlemen,
>
> 1. In a generic point of view, can I use this code? (Y/N)
> 2. Would it be technically correct? (Y/N)
>
> #include <stdlib.h>
>
> int main()
> {
> int a=3, b=2, *p;
>
> p=(int *)malloc(1*sizeof(int));
> *p = a + b;
>
> /* .... */
>
> free(p);
> }
>
> Thanks
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by:Crypto Challenge is now open!
> Get cracking and register here for some mind boggling fun and
> the chance of winning an Apple iPod:
> http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> _______________________________________________
> 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: Ioannis V. <iv...@em...> - 2003-03-15 23:17:29
|
-----------------------Original Message-----------------------
>From: Andr=E9 Mac=E1rio Barros [mailto:and...@su...]
>To: Dev-Cpp-Users [mailto:dev...@li...]
>Date: 16/3/2003 2:08:00 =F0=EC
>Subject: [Dev-C++] Correct use of pointers II
>
>Gentlemen,
>
> 1. In a generic point of view, can I use this code? (Y/N)
Yes, but the malloc() is in bad style C.
> 2. Would it be technically correct? (Y/N)
Yes.
>
>#include <stdlib.h>
>
>int main()
>{
> int a=3D3, b=3D2, *p;
>
> p=3D(int *)malloc(1*sizeof(int));
p=3Dmalloc(sizeof(int));
or
p=3Dmalloc(sizeof(*p));
> *p =3D a + b;
>
> /* .... */
>
> free(p);
>}
Ioannis Vranos=20
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL: http://run.to/noicys=20
|
|
From: Per W. <pw...@ia...> - 2003-03-15 23:03:00
|
Yes, it's technically correct, but normally when allocating memory you
should check that the allocattion succeeded, i.e. that p wasn't set to
NULL.
On the other hand, malloc/free are extremely expensive, and I can't really
se why anyone would need to allocate a single integer. Since the integer
often have the same size as the pointer, while the memory allocation
library will need to keep some book-keeping information for each
allocation, it's a very strange thing to do.
Since you need one pointer for every int* you allocate, you might use
integers directly instead, and save a huge amount of time and memory.
If you don't need how many elements you need to sture until the program is
run, it's still no use to allocate single integers. Allocate an array of
integers instead.
/Per W
On Sat, 15 Mar 2003, Andr=E9 Mac=E1rio Barros wrote:
> Gentlemen,
>
> 1. In a generic point of view, can I use this code? (Y/N)
> 2. Would it be technically correct? (Y/N)
>
> #include <stdlib.h>
>
> int main()
> {
> int a=3D3, b=3D2, *p;
>
> p=3D(int *)malloc(1*sizeof(int));
> *p =3D a + b;
>
> /* .... */
>
> free(p);
> }
>
> Thanks
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by:Crypto Challenge is now open!
> Get cracking and register here for some mind boggling fun and
> the chance of winning an Apple iPod:
> http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> _______________________________________________
> 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-15 22:58:48
|
For Linux, I'd suggest to look at the drivers directory tree of the kernel source. Linux is a dream to write device drivers for. /Per W On Sat, 15 Mar 2003, Andr=E9 Mac=E1rio Barros wrote: > Gentlemen, > > I need to develop a hardware for PC and I think I will need the bus sp= eed > instead of the serial ports. > I am studying the possibility to write the the code both for xp and Re= d > Hat in Dev-C++. > -->Do you have any kind of bibliography that covers writing codes for = I/O > in C++ for xp and > for linux? > > Thanks > Andre > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by:Crypto Challenge is now open! > Get cracking and register here for some mind boggling fun and > the chance of winning an Apple iPod: > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > _______________________________________________ > 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: <and...@su...> - 2003-03-15 22:45:06
|
Gentlemen, I need to develop a hardware for PC and I think I will need the bus speed instead of the serial ports. I am studying the possibility to write the the code both for xp and Red Hat in Dev-C++. -->Do you have any kind of bibliography that covers writing codes for I/O in C++ for xp and for linux? Thanks Andre |
|
From: <and...@su...> - 2003-03-15 22:44:59
|
Gentlemen,
1. In a generic point of view, can I use this code? (Y/N)
2. Would it be technically correct? (Y/N)
#include <stdlib.h>
int main()
{
int a=3, b=2, *p;
p=(int *)malloc(1*sizeof(int));
*p = a + b;
/* .... */
free(p);
}
Thanks
|
|
From: Napoleon A. <n_a...@ya...> - 2003-03-15 18:49:28
|
The program is Texture Mapping Part 2. The one which does not use Glut. Thanks. Napoleon. --- Damien Alleyne <g_...@ho...> wrote: --------------------------------- I'm not sure what could have caused that linking prob. If you haven't figure it out yet, tell me which Gametutorials.com tutorial is causing the error. I'll see if I can look into it. Original Gs Up >From: Napoleon Ahiable >To: Damien Alleyne , DevCpp >Subject: Re:[Dev-C++] `GL_BGR_EXT' undeclared >Date: Thu, 13 Mar 2003 12:26:57 -0800 (PST) > >Thanks alot Damien, >your solution helped get rid of the problem I had but I now get the >following linker error: > >Compiler: Default compiler >Building Makefile: "C:\Projects\OpenGl\Makefile.win" >Executing make... >make.exe -f "C:\Projects\OpenGl\Makefile.win" all >gcc.exe bitmap_class.o main.o OGL.o -o "NHOpenGL.exe" -L"C:/MinGW/lib" >-mwindows -lopengl32 -lglu32 >main.o(.text+0x4ee):main.cpp: undefined reference to >`__gxx_personality_sj0' > >make.exe: *** [NHOpenGL.exe] Error 1 >Execution terminated > > >--- Damien Alleyne wrote: > __________________________________________________ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com |
|
From: <rol...@mi...> - 2003-03-14 20:59:03
|
> > Any normally competent compiler should detect this form of pointer abuse, > and report the use of an uninitialized variable. > Dev-C++ / g++ does not report, but Visual Studio C++ does. "warning C4700: local variable 'p' used without having been initialized" Is there any compiler setting to make DevC++ report also like Microsoft does -- Roland Strålberg microshade mailto:ro...@st... http://stralberg.kalix.net |
|
From: Per W. <pw...@ia...> - 2003-03-14 20:54:24
|
No, if the compiler doesn't complain about my clumsiness, I would quickly
change to a better one :-)
/Per W
On Fri, 14 Mar 2003, Hal Kellerman wrote:
> small correction - the first line should read
> int a,b,c,*p =3D &c;
>
> otherwise your are still initializing p to an unknown value (if the compi=
ler
> lets you get away with it)
>
> Hal Kellerman
> ha...@ha...
>
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...]On Behalf Of Per
> Westermark
> Sent: Friday, March 14, 2003 12:19 PM
> To: jo mateix
> Cc: dev...@li...
> Subject: Re: [Dev-C++] Correct use of pointers
>
>
> The problem in this example is that the pointer is not initialized, i.e.
> it doesn't point to anything. An assignment to *p would then send the dat=
a
> just about anywhere, either corrupting the program, corrupting the OS
> (some OS doesn't protect their own memory), or generate an exception if
> outside of accessible memory for a machine with a memory management unit.
>
> Any normally competent compiler should detect this form of pointer abuse,
> and report the use of an uninitialized variable.
>
> Correct use must be either:
> int a,b,c,*p =3D c;
> *p =3D a+b; // Assign to c
> or
> int a,b,*p;
> p =3D new int;
> *p =3D a+b;
> delete p;
>
> /Per W
>
> On Fri, 14 Mar 2003, jo mateix wrote:
>
> > Hello.
> > I don't see any problem with your example (except for the non-standard
> "void
> > main"). Tell me if I'm wrong:
> > A pointer in the stack is the same thing as an automatic variable in th=
e
> > stack: it is released when you go out of scope, so no problem.
> Furthermore:
> > if you are concerned about eficiency, you shouldn't use the free store
> > unless you need it (for example when using dinamically allocated object=
s).
> > If you all don't aggree, please let me know. Thanks.
> >
> >
> >
> > >From: Andr=E9 Mac=E1rio Barros <and...@su...>
> > >To: "Dev-Cpp-Users" <dev...@li...>
> > >Subject: [Dev-C++] Correct use of pointers
> > >Date: Thu, 13 Mar 2003 21:46:02 -0300
> > >
> > >Gentlemen,
> > >
> > > Even in the Ritchie=B4s books sometimes I fount .C codes using "wi=
ld
> > >pointers" or something
> > >like:
> > >****************
> > >void main()
> > >{
> > > int *p, a, b;
> > >
> > > a=3D2;
> > > b=3D3;
> > > *p =3D a + b;
> > >
> > > ...
> > >}
> > >****************
> > >But... in large programs we can have problems.
> > >
> > > Would I be corret, allways, if I use insted a code like:
> > >*********************
> > >#include <stdlib.h> /* or alloc.h */
> > >
> > >void main()
> > >{
> > > int *p, a, b;
> > >
> > > p=3Dmalloc(1*sizeof(int));
> > > a=3D2;
> > > b=3D3;
> > > *p =3D a + b;
> > > ...
> > > free(p);
> > >}
> > >******************
> > >1. It=B4s not necessary, but is it tecnically correct?
> > >2. Is there any point, where the previous memory allocation is mandato=
ry?
> > >
> > >Thanks
> > >Andre
> > >
> > >
> > >
> > >
> > >-------------------------------------------------------
> > >This SF.net email is sponsored by:Crypto Challenge is now open!
> > >Get cracking and register here for some mind boggling fun and
> > >the chance of winning an Apple iPod:
> > >http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> > >_______________________________________________
> > >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
> >
> >
> > _________________________________________________________________
> > The new MSN 8: smart spam protection and 2 months FREE*
> > http://join.msn.com/?page=3Dfeatures/junkmail
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by:Crypto Challenge is now open!
> > Get cracking and register here for some mind boggling fun and
> > the chance of winning an Apple iPod:
> > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> > _______________________________________________
> > 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
> >
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by:Crypto Challenge is now open!
> Get cracking and register here for some mind boggling fun and
> the chance of winning an Apple iPod:
> http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> _______________________________________________
> 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: Hal K. <ha...@ha...> - 2003-03-14 20:50:04
|
small correction - the first line should read
int a,b,c,*p =3D &c;
otherwise your are still initializing p to an unknown value (if the compi=
ler
lets you get away with it)
Hal Kellerman
ha...@ha...
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Per
Westermark
Sent: Friday, March 14, 2003 12:19 PM
To: jo mateix
Cc: dev...@li...
Subject: Re: [Dev-C++] Correct use of pointers
The problem in this example is that the pointer is not initialized, i.e.
it doesn't point to anything. An assignment to *p would then send the dat=
a
just about anywhere, either corrupting the program, corrupting the OS
(some OS doesn't protect their own memory), or generate an exception if
outside of accessible memory for a machine with a memory management unit.
Any normally competent compiler should detect this form of pointer abuse,
and report the use of an uninitialized variable.
Correct use must be either:
int a,b,c,*p =3D c;
*p =3D a+b; // Assign to c
or
int a,b,*p;
p =3D new int;
*p =3D a+b;
delete p;
/Per W
On Fri, 14 Mar 2003, jo mateix wrote:
> Hello.
> I don't see any problem with your example (except for the non-standard
"void
> main"). Tell me if I'm wrong:
> A pointer in the stack is the same thing as an automatic variable in th=
e
> stack: it is released when you go out of scope, so no problem.
Furthermore:
> if you are concerned about eficiency, you shouldn't use the free store
> unless you need it (for example when using dinamically allocated object=
s).
> If you all don't aggree, please let me know. Thanks.
>
>
>
> >From: Andr=E9 Mac=E1rio Barros <and...@su...>
> >To: "Dev-Cpp-Users" <dev...@li...>
> >Subject: [Dev-C++] Correct use of pointers
> >Date: Thu, 13 Mar 2003 21:46:02 -0300
> >
> >Gentlemen,
> >
> > Even in the Ritchie=B4s books sometimes I fount .C codes using "wi=
ld
> >pointers" or something
> >like:
> >****************
> >void main()
> >{
> > int *p, a, b;
> >
> > a=3D2;
> > b=3D3;
> > *p =3D a + b;
> >
> > ...
> >}
> >****************
> >But... in large programs we can have problems.
> >
> > Would I be corret, allways, if I use insted a code like:
> >*********************
> >#include <stdlib.h> /* or alloc.h */
> >
> >void main()
> >{
> > int *p, a, b;
> >
> > p=3Dmalloc(1*sizeof(int));
> > a=3D2;
> > b=3D3;
> > *p =3D a + b;
> > ...
> > free(p);
> >}
> >******************
> >1. It=B4s not necessary, but is it tecnically correct?
> >2. Is there any point, where the previous memory allocation is mandato=
ry?
> >
> >Thanks
> >Andre
> >
> >
> >
> >
> >-------------------------------------------------------
> >This SF.net email is sponsored by:Crypto Challenge is now open!
> >Get cracking and register here for some mind boggling fun and
> >the chance of winning an Apple iPod:
> >http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> >_______________________________________________
> >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
>
>
> _________________________________________________________________
> The new MSN 8: smart spam protection and 2 months FREE*
> http://join.msn.com/?page=3Dfeatures/junkmail
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by:Crypto Challenge is now open!
> Get cracking and register here for some mind boggling fun and
> the chance of winning an Apple iPod:
> http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> _______________________________________________
> 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
>
-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open!
Get cracking and register here for some mind boggling fun and
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
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-14 20:20:03
|
The problem in this example is that the pointer is not initialized, i.e.
it doesn't point to anything. An assignment to *p would then send the data
just about anywhere, either corrupting the program, corrupting the OS
(some OS doesn't protect their own memory), or generate an exception if
outside of accessible memory for a machine with a memory management unit.
Any normally competent compiler should detect this form of pointer abuse,
and report the use of an uninitialized variable.
Correct use must be either:
int a,b,c,*p =3D c;
*p =3D a+b; // Assign to c
or
int a,b,*p;
p =3D new int;
*p =3D a+b;
delete p;
/Per W
On Fri, 14 Mar 2003, jo mateix wrote:
> Hello.
> I don't see any problem with your example (except for the non-standard "v=
oid
> main"). Tell me if I'm wrong:
> A pointer in the stack is the same thing as an automatic variable in the
> stack: it is released when you go out of scope, so no problem. Furthermor=
e:
> if you are concerned about eficiency, you shouldn't use the free store
> unless you need it (for example when using dinamically allocated objects)=
=2E
> If you all don't aggree, please let me know. Thanks.
>
>
>
> >From: Andr=E9 Mac=E1rio Barros <and...@su...>
> >To: "Dev-Cpp-Users" <dev...@li...>
> >Subject: [Dev-C++] Correct use of pointers
> >Date: Thu, 13 Mar 2003 21:46:02 -0300
> >
> >Gentlemen,
> >
> > Even in the Ritchie=B4s books sometimes I fount .C codes using "wild
> >pointers" or something
> >like:
> >****************
> >void main()
> >{
> > int *p, a, b;
> >
> > a=3D2;
> > b=3D3;
> > *p =3D a + b;
> >
> > ...
> >}
> >****************
> >But... in large programs we can have problems.
> >
> > Would I be corret, allways, if I use insted a code like:
> >*********************
> >#include <stdlib.h> /* or alloc.h */
> >
> >void main()
> >{
> > int *p, a, b;
> >
> > p=3Dmalloc(1*sizeof(int));
> > a=3D2;
> > b=3D3;
> > *p =3D a + b;
> > ...
> > free(p);
> >}
> >******************
> >1. It=B4s not necessary, but is it tecnically correct?
> >2. Is there any point, where the previous memory allocation is mandatory=
?
> >
> >Thanks
> >Andre
> >
> >
> >
> >
> >-------------------------------------------------------
> >This SF.net email is sponsored by:Crypto Challenge is now open!
> >Get cracking and register here for some mind boggling fun and
> >the chance of winning an Apple iPod:
> >http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> >_______________________________________________
> >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
>
>
> _________________________________________________________________
> The new MSN 8: smart spam protection and 2 months FREE*
> http://join.msn.com/?page=3Dfeatures/junkmail
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by:Crypto Challenge is now open!
> Get cracking and register here for some mind boggling fun and
> the chance of winning an Apple iPod:
> http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> _______________________________________________
> 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
>
|