dev-cpp-users Mailing List for Dev-C++ (Page 406)
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: Astar <As...@tu...> - 2003-04-03 23:36:23
|
Hello Neszt, In my opinion, it will be better to draw on idle (not WM_PAIMT, but when there is no any messages to translate in main loop). and synchronize all moving/animation/etc by multiplying step to reciprocal for fps. I do so, and i have smooth moving/rotation/etc... if you want source - try to my e-mail... NT> As I know, all the paint function should use after WM_PAINT. It is NT> also true for opengl display? I need to call the display() function 50 NT> times in every secounds. At this point of time, I use it after WM_PAINT, NT> and it seems like, the calls are happens as fast as it can. My solution to NT> aviod these quick calls is when the display() called, in the display() I NT> check the glut elapsed time, and if this is greather than 1/50 sec, I let NT> the display run over. NT> This is not good, as the results shows. The opengl moovings, rotatings, NT> and any other moovement not nicely continuous. NT> So, Is there any mode to set somehow the window, to call the WM_PAINT in NT> every 1/50 sec? P.S. sorry for my english :)... -- Best regards, Astar mailto:As...@tu... |
|
From: Ioannis V. <iv...@em...> - 2003-04-03 18:14:51
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Andrι Macαrio Barros
> Sent: Thursday, April 03, 2003 8:25 PM
> To: Dev-Cpp-Users
> Subject: [Dev-C++] Passig by Reference Question
>
>
> Dear Sirs (and Ladies, if you are here),
>
> Please, consider the three simple codes as follows:
>
> ##############################
> Program 1:
> 1 -#include <stdio.h>
> 2 -#include <stdlib.h>
> 3 -
> 4 -int sum(int, int);
> 5 -
> 6 -int main()
> 7 -{
> 8 - int a, b, c;
> 9 -
> 10- printf("Two Numbers Sum\n");
> 11- printf("Enter First Number-->");
> 12- scanf("%d", &a);
> 13- printf("Enter Second Number-->");
> 14- scanf("%d", &b);
> 15- c = sum(a,b);
> 16- printf("Sum of %d with %d is %d\n", a, b, c);
> 17- system("PAUSE");
> 18- return 0;
> 19-}
> 20-
> 21-int sum(int op1, int op2)
> 22-{
> 23- int res;
> 24-
> 25- res = op1 + op2;
> 26- return(res);
or return op1+op2; directly (but in reality sum() is not needed anyway).
> 27-}
> ##############################
> Program 2:
> 1 -#include <stdio.h>
> 2 -#include <stdlib.h>
> 3 -
> 4 -void sum(int, int, int *);
> 5 -
> 6 -int main()
> 7 -{
> 8 - int a, b, c;
> 9 -
> 10- printf("Two Numbers Sum\n");
> 11- printf("Enter First Number-->");
> 12- scanf("%d", &a);
> 13- printf("Enter Second Number-->");
> 14- scanf("%d", &b);
> 15- sum(a, b, &c);
> 16- printf("The Sum of %d with %d is %d\n", a, b, c);
> 17- system("PAUSE");
> 18- return 0;
> 19-}
> 20-
> 21-void sum(int op1, int op2, int *res)
> 22-{
> 23- *res = op1 + op2;
> 24-
> 25- return;
return statement is not needed here.
> 26-}
> ##############################
> Program 3:
> 1 -#include <stdio.h>
> 2 -#include <stdlib.h>
> 3 -
> 4 -void sum(int, int, int *);
> 5 -
> 6 -int main()
> 7 -{
> 8 - int a, b, *c;
> 9 -
> 10- c=(int *) malloc(sizeof(int));
Casting after malloc(), calloc() and realloc() IS NOT needed in C. K&R2 uses
casting because they tried the code in that time Storustrup's C++ compiler.
K&R2 also doesn't place a return statement before the end of main() which
was not proper C90. I assume that at least the first was fixed in later
editions.
So the above should be:
c=malloc(sizeof(int));
or (better):
c=malloc(sizeof(*c));
> 11- printf("Two Numbers Sum\n");
> 12- printf("Enter First Number-->");
> 13- scanf("%d", &a);
> 14- printf("Enter Second Number-->");
> 15- scanf("%d", &b);
> 16- sum(a, b, c);
> 17- printf("The Sum of %d with %d is %d\n", a, b, *c);
> 18- system("PAUSE");
> 19- return 0;
> 20-}
> 21-
> 22-void sum(int op1, int op2, int *res)
> 23-{
> 24- *res = op1 + op2;
> 25- return;
return; not needed.
> 26-}
> ################
> Fight Between Programmers Scenario:
> A-I prefer to use program 2 instead of program 3 to
> demonstrate the way how
> to use passing
> by reference over the original passing by value program 1.
> I prefer it
> because I find this
> kind of manipulation in the books and itsn´t necessary to change the
> nature of the variables
> (c integer variable in this case- look for line 8 in P2 and
> line 8 in P3);
> B-If we are already inside a function, and this function
> needs to pass a
> pointer variable to
> other funcion, ok, is only use a passing way like line 16
> of Program 3
> (integer pointer c
> variable in this case).
> ################
> My Question:
> Q1-Are both Programs, 2 and 3, correct? Please comment.
> Q2-Any opposition about my opinion in "A" Scenario?
> Q3-Any opposition about my opinion in "B" Scenario?
> Q4-Any additional comments?
See my comments above.
Ioannis Vranos
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL: http://run.to/noicys
Anti-racism movement: http://www.positive-youthfoundation.org
Iraq Peace Pledge: http://www.peacepledge.org
|
|
From: <and...@su...> - 2003-04-03 17:24:50
|
Dear Sirs (and Ladies, if you are here),
Please, consider the three simple codes as follows:
##############################
Program 1:
1 -#include <stdio.h>
2 -#include <stdlib.h>
3 -
4 -int sum(int, int);
5 -
6 -int main()
7 -{
8 - int a, b, c;
9 -
10- printf("Two Numbers Sum\n");
11- printf("Enter First Number-->");
12- scanf("%d", &a);
13- printf("Enter Second Number-->");
14- scanf("%d", &b);
15- c = sum(a,b);
16- printf("Sum of %d with %d is %d\n", a, b, c);
17- system("PAUSE");
18- return 0;
19-}
20-
21-int sum(int op1, int op2)
22-{
23- int res;
24-
25- res = op1 + op2;
26- return(res);
27-}
##############################
Program 2:
1 -#include <stdio.h>
2 -#include <stdlib.h>
3 -
4 -void sum(int, int, int *);
5 -
6 -int main()
7 -{
8 - int a, b, c;
9 -
10- printf("Two Numbers Sum\n");
11- printf("Enter First Number-->");
12- scanf("%d", &a);
13- printf("Enter Second Number-->");
14- scanf("%d", &b);
15- sum(a, b, &c);
16- printf("The Sum of %d with %d is %d\n", a, b, c);
17- system("PAUSE");
18- return 0;
19-}
20-
21-void sum(int op1, int op2, int *res)
22-{
23- *res = op1 + op2;
24-
25- return;
26-}
##############################
Program 3:
1 -#include <stdio.h>
2 -#include <stdlib.h>
3 -
4 -void sum(int, int, int *);
5 -
6 -int main()
7 -{
8 - int a, b, *c;
9 -
10- c=(int *) malloc(sizeof(int));
11- printf("Two Numbers Sum\n");
12- printf("Enter First Number-->");
13- scanf("%d", &a);
14- printf("Enter Second Number-->");
15- scanf("%d", &b);
16- sum(a, b, c);
17- printf("The Sum of %d with %d is %d\n", a, b, *c);
18- system("PAUSE");
19- return 0;
20-}
21-
22-void sum(int op1, int op2, int *res)
23-{
24- *res = op1 + op2;
25- return;
26-}
################
Fight Between Programmers Scenario:
A-I prefer to use program 2 instead of program 3 to demonstrate the way how
to use passing
by reference over the original passing by value program 1. I prefer it
because I find this
kind of manipulation in the books and itsn´t necessary to change the
nature of the variables
(c integer variable in this case- look for line 8 in P2 and line 8 in P3);
B-If we are already inside a function, and this function needs to pass a
pointer variable to
other funcion, ok, is only use a passing way like line 16 of Program 3
(integer pointer c
variable in this case).
################
My Question:
Q1-Are both Programs, 2 and 3, correct? Please comment.
Q2-Any opposition about my opinion in "A" Scenario?
Q3-Any opposition about my opinion in "B" Scenario?
Q4-Any additional comments?
Regards
Andre
|
|
From: Ioannis V. <iv...@em...> - 2003-04-03 16:35:56
|
> -----Original Message----- > From: Ioannis Vranos [mailto:iv...@em...] > Sent: Thursday, April 03, 2003 7:32 PM > To: 'Dev...@li...' > Subject: RE: [Dev-C++] why do we have to rename free() ? > > > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Khalid El-Kary > > Sent: Thursday, April 03, 2003 6:53 PM > > To: Dev...@li... > > Subject: RE: [Dev-C++] why do we have to rename free() ? > > > > > > so why does PHP source code compile similary on both windows > > and linux > > fellow ? :D > > > > Because it is very new and the development happens from a > central team. Once it became mainstream and hundrends of > companies provided their own implementations with extensions > uncompatible among them, the need for an official standard will occur. And if the creator wishes to leave his copyright so as other companies to implement their own PHP implementations and a standard to emerge. GNU licenses provide copyright protection. Noone can "steal" the product.... Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org |
|
From: Ioannis V. <iv...@em...> - 2003-04-03 16:31:52
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Khalid El-Kary > Sent: Thursday, April 03, 2003 6:53 PM > To: Dev...@li... > Subject: RE: [Dev-C++] why do we have to rename free() ? >=20 >=20 > so why does PHP source code compile similary on both windows=20 > and linux=20 > fellow ? :D Because it is very new and the development happens from a central team. = Once it became mainstream and hundrends of companies provided their own implementations with extensions uncompatible among them, the need for an official standard will occur. Ioannis Vranos =20 * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org |
|
From: Khalid El-K. <kha...@ho...> - 2003-04-03 15:53:40
|
> > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Khalid El-Kary > > Sent: Thursday, April 03, 2003 4:13 PM > > To: Dev...@li... > > Subject: RE: [Dev-C++] why do we have to rename free() ? > > > > > > I thought GNU, Apache, PHP, OPENSSL try to make there code as > > portable as > > possible ? > > > >Portable is only the standard language. If there is a standard named >OPENSSL, it means that code for it would be portable to every system >implementing it. Do not confuse Open Source with standards. Standards come >from standards committees. But the Open Source movement usually uses the >standards. :) so why does PHP source code compile similary on both windows and linux fellow ? :D > > > > > > >Ioannis Vranos > >* Programming pages: http://www.noicys.freeurl.com >* Alternative URL: http://run.to/noicys > > >Anti-racism movement: http://www.positive-youthfoundation.org >Iraq Peace Pledge: http://www.peacepledge.org > > > > >------------------------------------------------------- >This SF.net email is sponsored by: ValueWeb: >Dedicated Hosting for just $79/mo with 500 GB of bandwidth! >No other company gives more support or power for your dedicated server >http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ >_______________________________________________ >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 _________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail |
|
From: Ioannis V. <iv...@em...> - 2003-04-03 15:30:29
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Senthil Rajasekharan > Sent: Thursday, April 03, 2003 6:09 PM > To: dev...@li... > Subject: [Dev-C++] browsing the source of Standard C++ Libs >=20 >=20 > Hi, >=20 > Does anyone know of a way to browse classes of > Standard C++ Library implementation (either online or > with a compiler distrib such as g++ ) ? >=20 > -Senthil Do you mean an online reference? A fast way to find what you want: http://www.google.com.gr/search?q=3D%22C%2B%2B+standard+library%22+refere= nce&i e=3DUTF-8&oe=3DUTF-8&hl=3Del&lr=3D Ioannis Vranos =20 * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org |
|
From: Senthil R. <sen...@ya...> - 2003-04-03 15:08:55
|
Hi, Does anyone know of a way to browse classes of Standard C++ Library implementation (either online or with a compiler distrib such as g++ ) ? -Senthil __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com |
|
From: Ioannis V. <iv...@em...> - 2003-04-03 13:53:04
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Khalid El-Kary > Sent: Thursday, April 03, 2003 4:13 PM > To: Dev...@li... > Subject: RE: [Dev-C++] why do we have to rename free() ? > > > I thought GNU, Apache, PHP, OPENSSL try to make there code as > portable as > possible ? Portable is only the standard language. If there is a standard named OPENSSL, it means that code for it would be portable to every system implementing it. Do not confuse Open Source with standards. Standards come from standards committees. But the Open Source movement usually uses the standards. :) Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org |
|
From: Ioannis V. <iv...@em...> - 2003-04-03 13:32:44
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Carlos Garc=EDa del Monte > Sent: Thursday, April 03, 2003 2:06 PM > To: dev-cpp-users-list > Subject: Re: [Dev-C++] Passing programs from Borland 3.1 to=20 > Dev-C++ Pasar programas Borland 3.1 con Dev-C++ >=20 >=20 > Can someone explain me how can I pass programs wirtten with=20 > Borland to=20 > Dev-C++, specially the graphic programs? >=20 If the library is the same, and you do not use VCL but Win32 API, easily = I can guess. Regards, Ioannis Vranos =20 * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org |
|
From: Khalid El-K. <kha...@ho...> - 2003-04-03 13:13:26
|
> > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Khalid El-Kary > > Sent: Thursday, April 03, 2003 5:57 AM > > To: Dev...@li... > > Subject: [Dev-C++] why do we have to rename free() ? > > > > > > hi fellows, > > > > when i checked a lot of big project's source codes, I have found them > > replacing basic funtion names with new function names, and > > sometimes with a > > new way of functioning for example: > > > > free() -> OPENSSL_free() > > malloc() -> gnew(type, number of blocks) > > > > how can this be useful ?, does it have a thing to do with > > portability ?, and > > if not what's the difference in functionality ? > > >Additional, non-portable functionality. I thought GNU, Apache, PHP, OPENSSL try to make there code as portable as possible ? > > > >Ioannis Vranos > >* Programming pages: http://www.noicys.freeurl.com >* Alternative URL: http://run.to/noicys _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail |
|
From: Khalid El-K. <kha...@ho...> - 2003-04-03 13:11:59
|
thanx for the very detailed reply :-) >Small OS preallocates the stack to a fixed size at startup. OS using >virtual memory and MMU normally let's the stack grow at runtime. This >stack growth is one level below the use of dynamic allocation on heap, >since the OS uses the memory paging scheme of the processor. > >One method the OS may use is to add a write-protected guard page last on >the stack. As soon as the program tries to write to this guard page, the >OS gets a memory protection error. It detects that the stack is about to >overflow and oens the guard page for writing and adds a new guard page 4kB >(for x86) higher on the stack. This scheme may fail for a method using a >large auto buffer, since if the buffer is larger than the guard page, the >first write might come at a an address AFTER the guard page. A lot of >compilers will add extra code for functions with large auto variables, >where the extra funcrion prolog touches the stack in 4kB steps to let the >OS detect and add the needed number of new pages. > >One other method for the OS to handle the stack is to have a very large >hole in the virtual address space after the end of the stack. If an access >comes to the nearest MB (or whatever) of the stack top, the OS then >assumes that it isn't a bad pointer access but a function with large auto >variables, and then fills up the stack with needed number of new pages. > >A lot of OS does NOT allow the stack to grow for any threads that gets >started by the main process. This is because the virtual address space of >most processors is a bit cramped, and to leave large address map holes for >the individual stacks to grow into would seriously reduce number of >concurrent threads the process might have. At creation, the process have >to specify the maximum stack size needed for the new threads and then the >stacks are placed end-to-end in the virtual memory address map. > >Auto-allocated data is only possible when life span of a variable follows >the call nesting of the used functions, since the variables will be >automatically released when the function returns. No function might return >a pointer to one of it's auto variables, and have the caller reference >that pointer. > > >While there exists schemes for allocation of variable-sized data on the >stack, they are normally plagued by incompatiblities between compilers, >used processors etc and should normally not be used, i.e. if you don't >know the needed size in the beginning, the recommendation is to go for >heap allocation. > >If the needed memory block is very large, heap memory should also be used, >since the OS might have a stack size limit a lot smaller than malloc/new >might support. Also, some combinations of compilers and OS fails to detect >and auto-grow the stack for some scenarios with large auto variables. > > >A single call for dynamic allocation is not a problem. It's when the >allocation and/or release is in a loop or a time-critical part of a >program you'll have to watch out for the speed issue. > >For embedded programming there's the extra problem that asynchronous >events, such as interrupt service routines may normally not call most OS >and library functions, since that might result in deadlock. If a thread is >in a critical section the ISR needs access to, the OS can't just park the >ISR until the thread releases the critical section. > >/Per W > >On Thu, 3 Apr 2003, Khalid El-Kary wrote: > > > Hi fellows, > > > > right now i know that memory in the stack gets allocated for once during >the > > start-up of the programm, and dynamically allocated memory gets >allocated > > while the programm is running. > > > > stack memory is faster at execution. > > dynamic memory is slower (the time consumed by malloc/free) > > > > but ... > > > > I want to know when exactly should i use stack memory and when exactly > > should i use dynamic memory ? > > > > thanx in advance > > > > Regards, > > Khalid Al-Kary > > > > > > > > > > > > _________________________________________________________________ > > MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. > > http://join.msn.com/?page=features/virus > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: ValueWeb: > > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! > > No other company gives more support or power for your dedicated server > > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > > _______________________________________________ > > 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 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus |
|
From: <cg...@wo...> - 2003-04-03 11:13:25
|
Can someone explain me how can I pass programs wirtten with Borland to=20 Dev-C++, specially the graphic programs? Si utilizas el archivo de cabecera graphics.h, puedes bajarte el zip de=20 winbgim, que es una adaptaci=F3n para Dev. No tengo aqu=ED la direcci=F3n= ,=20 pero buscando en google la tendr=E1s en la primera p=E1gina de resultados= =2E (I talked a bit about winbgim and graphics.). No puedo contestarte completamente respeco qu=E9 pueda hacerse, puesto=20 que nunca he usado Borland. (I say I've never used Borland, so I can't give a serious answer) JOSE LUIS GARCIA GARCIA wrote: > =BFSi alguien es tan amable de explicarme como puedo pasar programas=20 > escritos en Borland 3.1, especialmente gr=E1ficos, al entorno Dev-C++. > Gracias. |
|
From: Per W. <pw...@ia...> - 2003-04-03 10:07:59
|
But the following code works: char buf1[30],buf2[30],*p1 = itoa(9,buf1), *p2 = itoa(10,buf2); It's quick since it doesn't use dynamic memory. It's reentrant since the thread uses it's own buffers and not a global buffer hidden somewhere within the itoa() implementation. It supports multiple stored answers for each thread. It may never leak memory, since the buffers are auto-allocated. That's why just about all itoa() implementations available with compilers or OS are taking the pointer as an input parameter. /Per W On Wed, 2 Apr 2003, Luigi Santillo wrote: > On Wed, Apr 02, 2003 at 01:48:06PM +0300, Ioannis Vranos wrote: > > This code is not good. Assume this: > > > > > > char *p=itoa(9), *q=itoa(10); > > > > > > I suggest to return a pointer on memory on the free store. > > > > Hello, > > You are right, my simple implementation does not cope well > with the above situation. I used the free store in my first > implementation, then, following some advice, I attempted to > use a static array, as that would probably be faster. > > Thanks for your suggestion > -- > >> gisan >> > > > ------------------------------------------------------- > This SF.net email is sponsored by: ValueWeb: > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! > No other company gives more support or power for your dedicated server > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > _______________________________________________ > 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-04-03 10:04:41
|
Since the caller supplies the buffer, itoa() then doesn't need to touch any global variables. That makes it possible for one thread to call itoa(), a task switch to happen and a new new thread to call itoa() without either a static buffer being corrupted by the two concurrent calls, or the second thread being blocked by a critical section. With a unprotected static buffer owned by itoa(), a second call from another thread while itoa() runs, or before the first thread is done with the returned pointer, would clear the static buffer and immediately try to reuse it. If the static buffer is protected by a critical section or mutex, then only one thread at a time may use the buffer INSIDE itoa(), while any other callers will be blocked until the first itoa() call returns. However, the calling program will not be able to use the static buffer before the next call from the other thread destroys the buffer. If the buffer is dynamically allocated, each concurrent call of itoa() will have their own buffer. This makes the call thread-safe. However, the allocation malloc(), calloc(), strdup(), new or whatever, must access a global list of available memory blocks for performing the allocation. To make these functions thread-safe, they will have to protect the actual allocation within a mutex or critical section. While this makes them thread-safe, it doesn't make them fully reentrant, since a second allocation call may not finish until the first allocation is through. This will force the second thread - doesn=B4t matter how high prio it has - to lock up until the first allocation is done. If implementing a ISR - interrupt service routine - it would not be alloced to cal the allocation function, so it woun't be allowed to call an itoa() that uses dynamic memory. That is because while the interrupt routine is active, there isn't possible for the OS to activate any threads. The thread calling itoa() would then permanently lock the ISR from ending, resulting in a dead-lock. When you send in the buffer as a parameter to itoa(), you never get that kind of problem, since each caller themself arrange for needed memory in a suitable way. All running tasks have their own stack so an auto-allocated buffer works find. As long as the buffer isn't large enough, the ISR may also allocate a buffer on the stack - it will denepnding on OS either have it's own OS-reserved stack, or using the free area of the currently running thread's stack. /Per W On Wed, 2 Apr 2003, Luigi Santillo wrote: > Hello Per, > > I see that you have mentioned that an implementation of itoa > which has the interface: > > void itoa(int n, char *s); > > would be "reentrant". This concept is not clear to me, I would > appreciate if you could elaborate a little about it, for instance > you could point out the weakness (or "reentrancy" problems) related > to the interface > > char *itoa(int n); > > and how these would be solved adopting the 2 parameters - void returning = - > function. > > TIA > -- > >> gisan >> > > > ------------------------------------------------------- > This SF.net email is sponsored by: ValueWeb: > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! > No other company gives more support or power for your dedicated server > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > _______________________________________________ > 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: Dondolo M. <MDo...@OL...> - 2003-04-03 10:03:15
|
Hi all.
I am getting there with c++. there is one question I would like to ask. I
was experimenting with a simple calculator program that I wrote. What the
program does is it prompts you to enter the first number, then the second
number. The next step , you are prompted to choose what you wanna do with
the numbers eg Multiply, add...
What I want is when the user selects his choice, the answer must be
displayed on a clean "page" and not show all the other previous info ...ie,
the numbers being calculated or the menu to select from.
//-----------
#include<iostream.h>
#include<stdlib.h>
//A funcion that adds two numbers
float Add(float x, float y)
{
return (x+y);
}
//-----------------------------
float Multiply(float x, float y)
{
return (x*y);
}
//----------------------------
float Minus(float x, float y)
{
return (x-y);
}
//--------------------
float Divide( float x, float y)
{
return (x/y);
}
//---------
//--------
main()// main function
{
float a,b,c;
int Ans;
cout<<"Enter first number : ";
cin>>a;
cout<<"...and the second number : ";
cin>>b;
cout<<"\n";
cout<< "\t\t\t 1)ADD\n"
"\t\t\t 2)DIVIDE\n"
"\t\t\t 3)MULTIPLY\n"
"\t\t\t 4)SUBTRACT\n";
cout<<"_";cin>>Ans;
if (Ans==1)
{
c=Add(a,b);
cout<<c;
}
if (Ans==2)
{
c= Divide(a,b);
cout<<c;
}
if(Ans==3)
{
c=Multiply(a,b);
cout<<c;
}
if(Ans==4)
{
c= Minus(a,b);
cout<<c;
}
system("PAUSE");
}
Mpho Dondolo
Support Analyst
Computer Sciences Corp. (CSC)
Tel: +27 21 503 0059
Fax: +27 21 509 5619
Cell: +27 84 337 1468
mdo...@cs...
mdo...@ol...
|
|
From: Neszt T. <ne...@ss...> - 2003-04-03 09:57:56
|
Hello! As I know, all the paint function should use after WM_PAINT. It is also true for opengl display? I need to call the display() function 50 times in every secounds. At this point of time, I use it after WM_PAINT, and it seems like, the calls are happens as fast as it can. My solution to aviod these quick calls is when the display() called, in the display() I check the glut elapsed time, and if this is greather than 1/50 sec, I let the display run over. This is not good, as the results shows. The opengl moovings, rotatings, and any other moovement not nicely continuous. So, Is there any mode to set somehow the window, to call the WM_PAINT in every 1/50 sec? Thank Your help in advance, Regards, Neszt Tibor |
|
From: Ricardo R. <ri...@po...> - 2003-04-03 08:16:54
|
you are right, you dont need to call strlen( ) and by the way, to include the header "string.h". Ricardo. |
|
From: Frank W. <F.W...@wi...> - 2003-04-03 08:14:39
|
Hi Kris, I also work with the Cygwin system, so you must modify the directories in the compiler environment settings form the default (for MinGW) to the corresponding for Cygwin . Hope that helps Greetings Frank >>> Kris Nackaerts <kna...@gm...> 04/03 9:46 >>> Dear, I downloaded and installed dev-C++ version 4.9.8.0 but cannot compile anything. I get the following message: cannot find entry symbol_mainCRTstartup; defaulting to 00401000 linker error: undefined reference to 'strcpy' etc. I can compile files with g++ version 2.95.3-5 in Cygwin which I used uptill now. The progra contains nothing special, reading ascii data, some basic calculations, export again+. Any help would be greatly appreciated. Kris ------------------------------------------------------- This SF.net email is sponsored by: ValueWeb: Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ _______________________________________________ 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: Kris N. <kna...@gm...> - 2003-04-03 07:46:15
|
Dear, I downloaded and installed dev-C++ version 4.9.8.0 but cannot compile anything. I get the following message: cannot find entry symbol_mainCRTstartup; defaulting to 00401000 linker error: undefined reference to 'strcpy' etc. I can compile files with g++ version 2.95.3-5 in Cygwin which I used uptill now. The progra contains nothing special, reading ascii data, some basic calculations, export again+. Any help would be greatly appreciated. Kris |
|
From: Luigi S. <gi...@li...> - 2003-04-03 07:21:18
|
Hello Per, I see that you have mentioned that an implementation of itoa which has the interface: void itoa(int n, char *s); would be "reentrant". This concept is not clear to me, I would appreciate if you could elaborate a little about it, for instance you could point out the weakness (or "reentrancy" problems) related to the interface char *itoa(int n); and how these would be solved adopting the 2 parameters - void returning - function. TIA -- >> gisan >> |
|
From: Luigi S. <gi...@li...> - 2003-04-03 07:21:14
|
On Wed, Apr 02, 2003 at 01:48:06PM +0300, Ioannis Vranos wrote: > This code is not good. Assume this: > > > char *p=itoa(9), *q=itoa(10); > > > I suggest to return a pointer on memory on the free store. > Hello, You are right, my simple implementation does not cope well with the above situation. I used the free store in my first implementation, then, following some advice, I attempted to use a static array, as that would probably be faster. Thanks for your suggestion -- >> gisan >> |
|
From: Per W. <pw...@ia...> - 2003-04-03 06:13:19
|
Small OS preallocates the stack to a fixed size at startup. OS using virtual memory and MMU normally let's the stack grow at runtime. This stack growth is one level below the use of dynamic allocation on heap, since the OS uses the memory paging scheme of the processor. One method the OS may use is to add a write-protected guard page last on the stack. As soon as the program tries to write to this guard page, the OS gets a memory protection error. It detects that the stack is about to overflow and oens the guard page for writing and adds a new guard page 4kB (for x86) higher on the stack. This scheme may fail for a method using a large auto buffer, since if the buffer is larger than the guard page, the first write might come at a an address AFTER the guard page. A lot of compilers will add extra code for functions with large auto variables, where the extra funcrion prolog touches the stack in 4kB steps to let the OS detect and add the needed number of new pages. One other method for the OS to handle the stack is to have a very large hole in the virtual address space after the end of the stack. If an access comes to the nearest MB (or whatever) of the stack top, the OS then assumes that it isn't a bad pointer access but a function with large auto variables, and then fills up the stack with needed number of new pages. A lot of OS does NOT allow the stack to grow for any threads that gets started by the main process. This is because the virtual address space of most processors is a bit cramped, and to leave large address map holes for the individual stacks to grow into would seriously reduce number of concurrent threads the process might have. At creation, the process have to specify the maximum stack size needed for the new threads and then the stacks are placed end-to-end in the virtual memory address map. Auto-allocated data is only possible when life span of a variable follows the call nesting of the used functions, since the variables will be automatically released when the function returns. No function might return a pointer to one of it's auto variables, and have the caller reference that pointer. While there exists schemes for allocation of variable-sized data on the stack, they are normally plagued by incompatiblities between compilers, used processors etc and should normally not be used, i.e. if you don't know the needed size in the beginning, the recommendation is to go for heap allocation. If the needed memory block is very large, heap memory should also be used, since the OS might have a stack size limit a lot smaller than malloc/new might support. Also, some combinations of compilers and OS fails to detect and auto-grow the stack for some scenarios with large auto variables. A single call for dynamic allocation is not a problem. It's when the allocation and/or release is in a loop or a time-critical part of a program you'll have to watch out for the speed issue. For embedded programming there's the extra problem that asynchronous events, such as interrupt service routines may normally not call most OS and library functions, since that might result in deadlock. If a thread is in a critical section the ISR needs access to, the OS can't just park the ISR until the thread releases the critical section. /Per W On Thu, 3 Apr 2003, Khalid El-Kary wrote: > Hi fellows, > > right now i know that memory in the stack gets allocated for once during the > start-up of the programm, and dynamically allocated memory gets allocated > while the programm is running. > > stack memory is faster at execution. > dynamic memory is slower (the time consumed by malloc/free) > > but ... > > I want to know when exactly should i use stack memory and when exactly > should i use dynamic memory ? > > thanx in advance > > Regards, > Khalid Al-Kary > > > > > > _________________________________________________________________ > MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. > http://join.msn.com/?page=features/virus > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ValueWeb: > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! > No other company gives more support or power for your dedicated server > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > _______________________________________________ > 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-04-03 05:06:48
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Khalid El-Kary > Sent: Thursday, April 03, 2003 5:57 AM > To: Dev...@li... > Subject: [Dev-C++] why do we have to rename free() ? > > > hi fellows, > > when i checked a lot of big project's source codes, I have found them > replacing basic funtion names with new function names, and > sometimes with a > new way of functioning for example: > > free() -> OPENSSL_free() > malloc() -> gnew(type, number of blocks) > > how can this be useful ?, does it have a thing to do with > portability ?, and > if not what's the difference in functionality ? Additional, non-portable functionality. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |
|
From: Ioannis V. <iv...@em...> - 2003-04-03 05:02:58
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Khalid El-Kary > Sent: Thursday, April 03, 2003 4:05 AM > To: Dev...@li... > Subject: [Dev-C++] dynamic or stack allocation ... > > > Hi fellows, > > right now i know that memory in the stack gets allocated for > once during the > start-up of the programm, Not only. > and dynamically allocated memory > gets allocated > while the programm is running. > > stack memory is faster at execution. In creation/destruction. > dynamic memory is slower (the time consumed by malloc/free) The time cost is not to be taken under consideration in nowadays ordinary systems (that is everything else than a microcontroller). > > but ... > > I want to know when exactly should i use stack memory and > when exactly > should i use dynamic memory ? Stack memory is very limited (typicaly 64 kb total available for a DOS program). The rest of memory can be seen as free store. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |