dev-cpp-users Mailing List for Dev-C++ (Page 4)
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
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
1
(24) |
2
(12) |
3
(10) |
4
(5) |
5
(30) |
6
(6) |
7
(18) |
8
(17) |
9
(36) |
10
(22) |
11
(7) |
12
(3) |
13
(10) |
14
(31) |
15
(6) |
16
(18) |
17
(18) |
18
(24) |
19
(9) |
20
(11) |
21
(43) |
22
(18) |
23
(32) |
24
(51) |
25
(38) |
26
(14) |
27
(12) |
28
(5) |
29
(24) |
30
(31) |
31
(12) |
|
|
From: <h.r...@gm...> - 2002-10-27 18:58:14
|
> > I've tried that but its still the same size. > > Try using UPX, an executable compressor. It should be available at > http://www.upx.org/. Otherwise, search on google. > > ___________________________________________________________ > > Abhijit Shylanath it's: http://upx.sourceforge.net/#download -- +++ GMX - Mail, Messaging & more http://www.gmx.net +++ NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen! |
From: Per W. <pw...@ia...> - 2002-10-27 17:02:05
|
Why not use a template class for the stacks, or at least use same data type for normal and temporary storage. That would halve the amount of code. Second. Constants MAX and maximum are not exactly a premium choice of variable names. Every thought of MAX_GARAGE_SIZE or something a bit more descriptive. Third. For school work, don't you have any school pals to discussion your home assignments with? /Per W |
From: senem b. <sbe...@ya...> - 2002-10-27 16:27:32
|
thanks a lot, i'll try it in a few minutes... got one more question to ask: i wrote a program using a few stacks, i compiled it and it seems to be working... however, it doesn't do what i intend to do... in the program, there are two stacks called garage1 and garage2 and there's another stack called temporary which i use to hold the popped elements values. but i strangely can't pop the value i'm looking for, only the last element is popped... the code is huge,i'll mark the part which doesn't work and i'll be glad if anyone would look at it and tell me where i'm going wrong... kind regards... senem #include <iostream.h> #include <stdlib.h> #include <string.h> #define MAX 5 #define maximum 1 typedef struct garage{ int elements; int top; int array[MAX]; }garage; typedef struct temp_storage{ int tempelements; int temptop; int temparray[maximum]; // has to be replaced with a string array }temp_storage; garage garage1,garage2,temporary;// temporary to store while temp_storage garage3; // removing a car from the stacks // 1 and 2 int addcar(int &,int &); // i don't know if it makes any sense int removecar(int,int &); // but i have to use these 2 functions // the teacher said void create(garage &); void push (int,garage&); int pop(garage&); int isfull(garage&); int isempty(garage&); void display(garage &); void temp_create(temp_storage&); void temp_push(int,temp_storage&); int temp_pop(temp_storage&); int temp_empty(temp_storage&); int temp_full(temp_storage&); void temp_display(temp_storage&); int findel(garage &,int); file://reference?? void error(char *); int temp_findel(temp_storage&,int); file://reference?? int main(){ char answer; int garage_no=0; int num; create(garage1); create(garage2); create(temporary); temp_create(garage3); while(true){ cout<<"park or remove the car(p/r)"; cin>>answer; if(answer=='p'){ cout<<"plaka no:"; cin>>num; if(addcar(garage_no,num)){ cout<<"successfully placed"<<endl; cout<<"car parked in the "<<garage_no <<"th garage"<<endl; } else cout<<"car not placed"<<endl; display(garage1); display(garage2); temp_display(garage3); } else if(answer=='r'){ cout<<"number:"; cin>>num; cout<<"garage no:"; cin>>garage_no; if(removecar(garage_no,num)) cout<<"car found and successfully delivered"<<endl; else cout<<"car not found"<<endl; display(garage1); display(garage2); temp_display(garage3); } else error("check the entered letter"); cout<<"continue(y/n)??"; cin>>answer; if(answer=='n') break; } return 0; } void create(garage &line){ for(int i=0;i<MAX;i++) line.array[i]=0; line.elements=0; line.top=0; } void temp_create(temp_storage &line){ for(int j=0;j<maximum;j++) line.temparray[j]=0; line.tempelements=0; line.temptop=0; } void display(garage &line){ for(int k=0;k<line.top;k++) cout<<line.array[k]<<" "; cout<<endl; } void temp_display(temp_storage &line){ for(int a=0;a<line.temptop;a++) cout<<line.temparray[a]<<" "; cout<<endl; } int isfull(garage &line){ return(line.elements==MAX); } int temp_isfull(temp_storage &line){ return(line.tempelements==maximum); } int isempty(garage & line){ return(line.elements==0); } int temp_isempty(temp_storage &line){ return(line.tempelements==0); } void push(int element,garage& line){ if(!isfull(line)){ line.array[line.top]=element; line.top++; line.elements++; } else{ cout<<"error,cannot push,stack is full"<<endl; exit(1); } } void temp_push(int element,temp_storage& line){ if(!temp_isfull(line)){ line.temparray[line.temptop]=element; line.temptop++; line.tempelements++; } else{ cout<<"error,cannot push,stack is full"<<endl; exit(1); } } int pop(garage &line){ int r; if(isempty(line)){ cout<<"error,cannot pop,stack is empty"<<endl; exit(1); } else{ line.top--; r=line.array[line.top]; line.elements--; return r; } } int temp_pop(temp_storage &line){ int result; if(temp_isempty(line)){ cout<<"error,cannot pop,stack is empty"<<endl; exit(1); } else{ line.temptop--; result=line.temparray[line.temptop]; line.tempelements--; return result; } } int addcar(int &garagenum,int &carnum){ if(garage1.elements<MAX){ garagenum=1; push(carnum,garage1); return 1; } else if(garage2.elements<MAX){ cout<<"garage 1 is full"<<endl; garagenum=2; push(carnum,garage2); return 1; } else if(garage3.tempelements<maximum){ cout<<"garage 1 and garage 2 are full"<<endl; garagenum=3; temp_push(carnum,garage3); return 1; } else{ cout<<"all places reserved"<<endl; return 0; } } void error(char *sentence){ cout<<sentence<<endl; } /*int removecar(int garagenum,int &carnum){ int popped_num1,popped_num2,popped_num3; int i=0; if(garagenum==1){ while(garage1.array[i]!=carnum){ popped_num1=pop(garage1); push(popped_num1,temporary); i++; } popped_num1=pop(garage1); while(!isempty(temporary)){ popped_num2=pop(temporary); push(popped_num2,garage1); } popped_num3=temp_pop(garage3); push(popped_num3,garage1); return 1; } if(garagenum==2){ i=0; while(garage2.array[i]!=carnum){ popped_num1=pop(garage2); push(popped_num1,temporary); i++; } popped_num1=pop(garage2); while(!isempty(temporary)){ popped_num2=pop(temporary); push(popped_num2,garage2); } popped_num3=temp_pop(garage3); push(popped_num3,garage2); return 1; } if(garagenum==3){ if(findel(garage1,carnum)){ i=0; while(garage1.array[i]!=carnum){ popped_num1=pop(garage1); push(popped_num1,temporary); i++; } popped_num1=pop(garage1); while(!isempty(temporary)){ popped_num2=pop(temporary); push(popped_num2,garage1); } return 1; } if(findel(garage2,carnum)){ i=0; while(garage2.array[i]!=carnum){ popped_num1=pop(garage2); push(popped_num1,temporary); i++; } popped_num1=pop(garage2); while(!isempty(temporary)){ popped_num2=pop(temporary); push(popped_num2,garage2); } popped_num3=temp_pop(garage3); push(popped_num3,garage2); return 1; } if(temp_findel(garage3,carnum)){ popped_num1=temp_pop(garage3); return 1; } else return 0; } } */ int findel(garage & line,int element){ for(int i=0;i<line.top;i++){ if(line.array[i]==element) return 1; else return 0; } } int temp_findel(temp_storage &line,int element){ for(int i=0;i<line.temptop;i++){ if(line.temparray[i]==element) return 1; else return 0; } } --------------------------------- Do you Yahoo!? Y! Web Hosting - Let the expert host your web site |
From: Per W. <pw...@ia...> - 2002-10-27 14:40:14
|
But most proably that wasn't the intention. The fact that both array and string was sized with max must mean something... in this case a failed attempt at space for the characters. By mistake, the declaration instead created a number of pointers. char *ptr; char string[max]; ptr = new char[max]; strncpy(ptr,string,max); ptr[max-1] = '\0'; or instead string[max-1] = '\0'; ptr = strdup(string); /Per W On Sun, 27 Oct 2002, Abhijit Shylanath wrote: > > got a question: > > i'd like to copy a char string to a string of pointers but i can't get the > > code working...and i can't see the result with cout... anyone who can help > > me?? > > kind regards, > > senem > > > #include <iostream.h> > > #include <stdlib.h> > > #include <string.h> > > #include <stdio.h> > > #define max 5 > > int main(){ > > char *array[max]; > > Here, you've just declared an array of pointers. You haven't actually > allocated memory, so the pointers are not valid. You need to new[] it, like > so. > > array[0] = new char[max]; > > and so on. > > > char string[max]; > > cout<<"enter string :"; > > cin.getline(string,max); > > strncpy(array[0],string,sizeof(string)/sizeof(char)); > > cout<<array[0]; > > return 0; > > } > > ___________________________________________________________ > > Abhijit Shylanath > > E-mail: mu...@gm... || ibr...@bi... > Web-site: http://mudeth.tripod.com/ > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ApacheCon, November 18-21 in > Las Vegas (supported by COMDEX), the only Apache event to be > fully supported by the ASF. http://www.apachecon.com > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Abhijit S. <mu...@gm...> - 2002-10-27 13:33:43
|
> got a question: > i'd like to copy a char string to a string of pointers but i can't get the > code working...and i can't see the result with cout... anyone who can help > me?? > kind regards, > senem > #include <iostream.h> > #include <stdlib.h> > #include <string.h> > #include <stdio.h> > #define max 5 > int main(){ > char *array[max]; Here, you've just declared an array of pointers. You haven't actually allocated memory, so the pointers are not valid. You need to new[] it, like so. array[0] = new char[max]; and so on. > char string[max]; > cout<<"enter string :"; > cin.getline(string,max); > strncpy(array[0],string,sizeof(string)/sizeof(char)); > cout<<array[0]; > return 0; > } ___________________________________________________________ Abhijit Shylanath E-mail: mu...@gm... || ibr...@bi... Web-site: http://mudeth.tripod.com/ |
From: Abhijit S. <mu...@gm...> - 2002-10-27 13:33:26
|
> I've tried that but its still the same size. Try using UPX, an executable compressor. It should be available at http://www.upx.org/. Otherwise, search on google. ___________________________________________________________ Abhijit Shylanath E-mail: mu...@gm... || ibr...@bi... Web-site: http://mudeth.tripod.com/ |
From: Abhijit S. <mu...@gm...> - 2002-10-27 13:33:22
|
>Sirs, > > I am having linking problems trying to compile programs with >winsock.h and tangensoft.net/wskfaq is telling me that probably I am >using the wrong library. > > How can I add in my Project Options the wsock32.lib file to build >basic console based C/C++ programs for Tcp/Ip? .lib files are only available on VC++. In Dev (MingW (GCC))), libraries are named as lib*.a (example, libwsock32.a). To use it in your program, simply add -lwsock32 to your command-line (under Project > Project Options > General > Linker Options/Optional Libs or Object Files). All the libraries available can be checked under the dev/lib folder. ___________________________________________________________ Abhijit Shylanath E-mail: mu...@gm... || ibr...@bi... Web-site: http://mudeth.tripod.com/ |
From: senem b. <sbe...@ya...> - 2002-10-27 12:01:42
|
got a question: i'd like to copy a char string to a string of pointers but i can't get the code working...and i can't see the result with cout... anyone who can help me?? kind regards, senem #include <iostream.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #define max 5 int main(){ char *array[max]; char string[max]; cout<<"enter string :"; cin.getline(string,max); strncpy(array[0],string,sizeof(string)/sizeof(char)); cout<<array[0]; return 0; } --------------------------------- Do you Yahoo!? Y! Web Hosting - Let the expert host your web site |
From: Ioannis V. <no...@ho...> - 2002-10-27 07:18:48
|
As i have said a few days ago, Longhorn will provide only a managed API (.NET). Here is some more info from a non-programming newsletter: =20 =20 - New applications and activity centers based on Longhorn's Avalon API, which appears to be an XML-based successor to the Win32 API that current Windows applications use. An example of this new type of application is Display Properties, which presents a vastly different UI from today's simple dialog boxes. In the Longhorn alpha screenshots I've seen, Display Properties is a single-window, task-based application that's similar to XP's User Accounts application. Another example of this type of application is My Hardware, which features a collapsible and graphic view of your PC's hardware divided into categories such as Audio Devices and Input Devices. =20 =20 Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com <http://www.noicys.freeurl.com/>=20 * Alternative URL: http://run.to/noicys =20 |
From: B. <ama...@uo...> - 2002-10-26 18:20:59
|
Sirs, I am having linking problems trying to compile programs with winsock.h and tangensoft.net/wskfaq is telling me that probably I am using the wrong library. How can I add in my Project Options the wsock32.lib file to build basic console based C/C++ programs for Tcp/Ip? Available files are only the devc++\lib\wsock32.def and windows\system\wsock32.dll. Do I need to download the wsock32.lib? If I need, the place to indicate it is in the Project Options, Add Object File Option? .lib is the correct extension? and .def and .a? Regards Andr=E9 |
From: Per W. <pw...@ia...> - 2002-10-26 15:42:22
|
I just whish that whenever Dev-C++ is run for the first time, it would display a VERY large text message requiring at least ten mouse clicks to close. For pause of cmd programs, insert system("PAUSE"); For help files, do... There are a couple of questions that arrives a bit more often than others :-) /Per W On Sat, 26 Oct 2002, Hans-J=F6rg Stangor wrote: > Hi Sivan, >=20 > >>when i try to run a program the output screen flashes by so fast i can'= t > actually >>see the output! > >>what can i do to make the output screen stay? >=20 > Before your return statement inside the main() routine insert a >=20 > system("Pause"); >=20 > statement. >=20 > Here a short example that should work for you: >=20 > #include <iostream.h> > #include <stdlib.h> >=20 > int main(int argc, char *argv[]) > { > cout << "Hi there!!!...\r\n"; > system("PAUSE"); > return 0; > } >=20 >=20 > >>and another question, why can't the program find "help"? >=20 > Help is not included but you can use the vUpdate Program > to load it from the Update-Server. You will find a lot of things > to download (about 50 single downloads) but most important is > i guess to get the latest vUpdate Program first (done automatically) > and afterwards the latest Dev-Cpp, the Help File and the tips for > the language you have set your IDE to. (Dont wonder if you have to > update Dev-Cpp immediately after you downloaded it... it is some > versions behind the current version because of the fast development > cycle of the code monkeys :-) [And i think you do a fabulous work, > guys!) >=20 > The download > speed depends on the time of day a little i found out... a lot > of persons seem to update on a regular basis :-) >=20 > You also should check the Resource Page found on Bloodshed Webpage > for a lot of useful tutorials. And if you're in search for a free ebook t= ry > Thinking in C++ by Bruce Eckel. It's located on www.mindview.net . But > i posted that already a while back here :-) >=20 > Hope this helps. >=20 > Best wishes, > Hans-J=F6rg (who's also trying to get started with C++) >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: ApacheCon, November 18-21 in > Las Vegas (supported by COMDEX), the only Apache event to be > fully supported by the ASF. http://www.apachecon.com > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >=20 |
From: <hj...@hj...> - 2002-10-26 15:31:22
|
Hi Sivan, >>when i try to run a program the output screen flashes by so fast i can't actually >>see the output! >>what can i do to make the output screen stay? Before your return statement inside the main() routine insert a system("Pause"); statement. Here a short example that should work for you: #include <iostream.h> #include <stdlib.h> int main(int argc, char *argv[]) { cout << "Hi there!!!...\r\n"; system("PAUSE"); return 0; } >>and another question, why can't the program find "help"? Help is not included but you can use the vUpdate Program to load it from the Update-Server. You will find a lot of things to download (about 50 single downloads) but most important is i guess to get the latest vUpdate Program first (done automatically) and afterwards the latest Dev-Cpp, the Help File and the tips for the language you have set your IDE to. (Dont wonder if you have to update Dev-Cpp immediately after you downloaded it... it is some versions behind the current version because of the fast development cycle of the code monkeys :-) [And i think you do a fabulous work, guys!) The download speed depends on the time of day a little i found out... a lot of persons seem to update on a regular basis :-) You also should check the Resource Page found on Bloodshed Webpage for a lot of useful tutorials. And if you're in search for a free ebook try Thinking in C++ by Bruce Eckel. It's located on www.mindview.net . But i posted that already a while back here :-) Hope this helps. Best wishes, Hans-Jörg (who's also trying to get started with C++) |
From: Ioannis V. <no...@ho...> - 2002-10-26 13:58:10
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Louis Godio > Sent: Saturday, October 26, 2002 3:30 AM > To: se...@al...; Per Westermark > Cc: dev...@li... > Subject: RE: [Dev-C++] dynamic allocation and structs >=20 >=20 >=20 > What was the final answer to the the original question asked: > "what is the duration of memory allocated by malloc (etc.)? " >=20 > If not freed manually or by a destructor, Does the memory ALWAYS get > released when the main() program ends with a normal exit ?=20 Yes. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |
From: sivan r. <siv...@ya...> - 2002-10-26 13:37:41
|
hello after downloading dev-c++ i have encountered a problem. when i try to run a program the output screen flashes by so fast i can't actually see the output! what can i do to make the output screen stay? and another question, why can't the program find "help"? thanx alot sivan ran siv...@ya... Sivan Ran Biotechnology BSc. Bar Ilan University --------------------------------- Do you Yahoo!? Y! Web Hosting - Let the expert host your web site |
From: Paul B. <pa...@ad...> - 2002-10-26 11:47:25
|
I've tried that but its still the same size. ----- Original Message ----- From: "Carlos Garc=EDa del Monte" <cg...@wo...> To: "dev-cpp-users-list" <dev...@li...> Sent: Saturday, October 26, 2002 8:25 PM Subject: Re: [Dev-C++] large exe size The compiler option -s. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.401 / Virus Database: 226 - Release Date: 9/10/2002 |
From: Carlos d. M. <cg...@wo...> - 2002-10-26 11:17:45
|
The compiler option -s. Paul Bray escribi=F3: > When I call a windows function in c++ the exe's size jumps from about 1= 0k to > 49k. > > heres an example: > > #include <windows.h> > > int main(int argc, char *argv[]) > { > DWORD t; > > //t=3DGetTickCount(); > return 0; > } > > if I uncomment the 't=3DGetTickCount();' it gets to 49k. > Is there a way to make it smaller? > > Paul > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.401 / Virus Database: 226 - Release Date: 9/10/2002 > > ------------------------------------------------------- > This SF.net email is sponsored by: ApacheCon, November 18-21 in > Las Vegas (supported by COMDEX), the only Apache event to be > fully supported by the ASF. http://www.apachecon.com > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Per W. <pw...@ia...> - 2002-10-26 10:54:28
|
Never call any windows functions :-) Whenever you call library functions, your exe-file will of course increase in size with the implementation of the library function. However, that library function might need to call other library fuctions, resulting in a single call in your program adding a lot of size to the exe file. For some libraries, it is possible to use dynamic linking, i.e. to use a xx.DLL instead of a xx.LIB. This means that your exe will stay small, but if you send out the binary, you must also make sure that the receiver of the exe file has the needed DLL files (of same or higher version). /Per W On Sat, 26 Oct 2002, Paul Bray wrote: > When I call a windows function in c++ the exe's size jumps from about 10k to > 49k. > > heres an example: > > #include <windows.h> > > int main(int argc, char *argv[]) > { > DWORD t; > > //t=GetTickCount(); > return 0; > } > > if I uncomment the 't=GetTickCount();' it gets to 49k. > Is there a way to make it smaller? > > Paul > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.401 / Virus Database: 226 - Release Date: 9/10/2002 > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ApacheCon, November 18-21 in > Las Vegas (supported by COMDEX), the only Apache event to be > fully supported by the ASF. http://www.apachecon.com > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Per W. <pw...@ia...> - 2002-10-26 10:50:03
|
----MyHeader.h---- #define LEN_OF_SHELLNAME 50 #define MAX_SHELLS 4096 typedef struct { ... } shell_t; int read_shells(); void print_shells(const char* filename); extern shell database[]; extern int shell_count; ----------------- ----MyMain.c---- #include <stdio.h> #include <stdlib.h> ... #include "MyHeader.h" // All global variables for the program. shell_t database[MAX_SHELLS]; int shell_count = 0; int main(int argc,const char* argv[],const char* env[]) { ... if (read_shells()) { print_shells("a_filename.txt"); } return 0; } --------------------- ----MyUtils.c #include <stdio.h> #include <stdlib.h> ... #include "MyHeader.h" // Return 1 if ok // Return 0 if error or terminated int read_shells() { ... return !terminated; } void print_shells(const char* filename) { ... } ----------------------- On Sat, 26 Oct 2002, Rob Peacock wrote: > Hi all, > > I have a couple of questions for you and they probably have simple answers. > I hope you can help. > > Using your advice, I have created an array of structs, essentially building > a database, mostly of int's and a couple of char arrays. I also built in > some input testing so that I know the data coming in is what it is supposed > to be. > > Since this is a fairly large file, and my instructor from years ago told me > to keep main() small and uncluttered by keeping 'functional modules' in > their own files, and then #include them in main(), I would like to do just > that. The problem I have is that the data in the array is unavailable to > main() and other similar functions. He also mentioned that only variables > that must be global should, and most don't have to be. > > In perusing one of my manuals, it mentions that the variables should be > made global by defining them in main() and then declaring them in a header > file using 'extern' but it was kind of unclear on how to do this. Since > this is going to be something I am sure I will be doing in a couple other > places, I would like to get a clear understanding of this. > > Here is the struct, array, and constants that I want to make global: > -------- file data_in.c ----- > #define LEN_OF_SHELLNAME 50 > #define MAX_SHELLS 4096 > > typedef struct > { > int ShellIndex; > int CueNumber; > int ShellSize; > float BreakDelay; > float ShellDuration; > char ShellName[LEN_OF_SHELLNAME]; > float ElapsedTime; > } database ; > > database ShellCatalog[MAX_SHELLS]; > > I want to be able to twiddle the data from within main() or from within > other functions that may be called from somewhere else. > > My second question is that someone mentioned in a prior post that by using > malloc(), realloc(), and free(), I could reduce the memory requirements by > only allocating the minimum memory required by the above array, especially > if I don't use the max number of records (4096). I'm sure that by making it > more memory efficient, it will run a bit faster as well. How would I > implement this? Be quite wary of the realloc() function. Yes it does work, but it is very, very, very expensive to use. It might require quite a lot of time to perform the request, and it might result in a very fragmented memory, i.e. when it grows the size of an allocated memory block, it might have to move the block somewhere else, while leaving a unused hole of memory at the old location. Depending on other parts of the application, these holes might never be reused. A preferred solution is to allocate exactly the correct amount directly: count = ask_for_shell_count(); shell_t *database = (shell_t*)malloc(count*sizeof(shell_t)); If count can't be known in advance, go for the vector of pointer alternative. // Will consume 16kB (4096*4) memory independent on size of shell_t shell_t* database[MAX_SHELLS]; while (have_more_shells) { if (shell_count >= MAX_SHELLS) { complain_about_shell_count(); break; } database[shell_count] = malloc(sizeof(shell_t)); database[shell_count++] = read_one_shell(); } > > All comments are appreciated and thanks for all of your help! > > --->Rob > > > ------------------------------------------------------- > This SF.net email is sponsored by: ApacheCon, November 18-21 in > Las Vegas (supported by COMDEX), the only Apache event to be > fully supported by the ASF. http://www.apachecon.com > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Per W. <pw...@ia...> - 2002-10-26 10:28:56
|
Unless you work in embedded environments - set-top boxes, cameras, burglar alarms, ... - you can be pretty sure that you have an OS that will release all memory uppon termination of your program. However, you normally should take care of releasing your memory anyway for the following reasons: - If the program does a lot of alloc/free, and you want to make sure that the program isn't leaking memory, constantly growing in size. There are a number of memory heap check programs that on termination of the program prints out a reference to all memory not released. Obviously, this isn't meaningful if you intentionally ignores the release of some memory. The printout will contain a lot of nice then. - If your aim is to change from C to C++. When the OS releases memory, it will never call any object destructors, and a number of C++ objects might have other side effects besides just consuming memory :-) such as => Closing and removing temporary files. => Removing a hourglass icon, and replacing with normal arrow icon. => Terminating another program (IDE don't need a compiler anymore). When you do implement a C++ class, you really do expect the destructor to be called, and consider it quite rude if someone don't release the object before ending the program. /Per W On Fri, 25 Oct 2002, Scott Williams wrote: > Don't know if anyone responded yet but I think the answer is: Yes, unless > your OS messes up. The release of the memory wasn't actually my concern, > however, I just wanted to be sure memory I allocated in one part of my > program was going to be available elsewhere. > > Scott > > -----Original Message----- > From: Louis Godio [mailto:lg...@ya...] > Sent: Friday, October 25, 2002 8:30 PM > To: se...@al...; Per Westermark > Cc: dev...@li... > Subject: RE: [Dev-C++] dynamic allocation and structs > > What was the final answer to the the original question asked: > "what is the duration of memory allocated by malloc (etc.)? " > > If not freed manually or by a destructor, Does the memory ALWAYS get > released when the main() program ends with a normal exit ? > > --- Scott Williams <se...@al...> wrote: > > Thanks for the replies to my question (and the entertaining > > discussion it led to). It was all very helpful. > > > > Scott > > > > -----Original Message----- > > From: Per Westermark [mailto:pw...@ia...] > > Sent: Thursday, October 24, 2002 9:13 AM > > To: Scott Williams > > Cc: dev...@li... > > Subject: Re: [Dev-C++] dynamic allocation and structs > > > > // Alternative 1, array of entries. > > mystruct *myarray; > > void func(int count) { > > int i; > > myarray = (mystruct*)malloc(count*sizeof(mystruct)); > > for (i = 0; i < count; i++) { > > myarray[i].xx = yy; > > } > > } > > > > // Alternative 2, array of pointers to entries. > > mystruct **myarray; > > void func(int count) { > > int i; > > myarray = (mystruct**)malloc(count*sizeof(*mystruct)); > > for (i = 0; i < count; i++) { > > myarray[i] = (mystruct*)malloc(sizeof(mystruct)); > > myarray[i]->xx = yy; > > } > > } > > > > /Per W > > > > On Thu, 24 Oct 2002, Scott Williams wrote: > > > >> Hi, > >> > >> I'm working in C (no C++ please). Got a couple of questions > >> related to dynamic allocation and in particular, dynamically > >> allocating an array of structs. > >> > >> First, what is the duration of memory allocated by malloc > >> (etc.)? In particular, I want to dynamically allocate/de- > >> allocate several global variables within a single subroutine > >> called from main and so want to be sure that the allocated > >> memory exists beyond the scope of that subroutine. > >> > >> Second, it is my understanding that it is perfectly acceptable > >> to have an array of structs. E.g., > >> > >> struct mystruct { > >> double var1; > >> long var2; > >> etc... > >> } > >> > >> . . . > >> > >> struct mystruct data[100]; > >> > >> Is this correct? If so, what then is the calling sequence to > >> dynamically allocate an array of structs, and, in particularly, > >> make the result available globally? > >> > >> Thanks for your help (& sorry if this is naive). > >> > >> Scott Williams > > |
From: Paul B. <pa...@ad...> - 2002-10-26 09:15:40
|
When I call a windows function in c++ the exe's size jumps from about 10k to 49k. heres an example: #include <windows.h> int main(int argc, char *argv[]) { DWORD t; //t=GetTickCount(); return 0; } if I uncomment the 't=GetTickCount();' it gets to 49k. Is there a way to make it smaller? Paul --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.401 / Virus Database: 226 - Release Date: 9/10/2002 |
From: Rob P. <py...@ea...> - 2002-10-26 07:30:22
|
Hi all, I have a couple of questions for you and they probably have simple answers. I hope you can help. Using your advice, I have created an array of structs, essentially building a database, mostly of int's and a couple of char arrays. I also built in some input testing so that I know the data coming in is what it is supposed to be. Since this is a fairly large file, and my instructor from years ago told me to keep main() small and uncluttered by keeping 'functional modules' in their own files, and then #include them in main(), I would like to do just that. The problem I have is that the data in the array is unavailable to main() and other similar functions. He also mentioned that only variables that must be global should, and most don't have to be. In perusing one of my manuals, it mentions that the variables should be made global by defining them in main() and then declaring them in a header file using 'extern' but it was kind of unclear on how to do this. Since this is going to be something I am sure I will be doing in a couple other places, I would like to get a clear understanding of this. Here is the struct, array, and constants that I want to make global: -------- file data_in.c ----- #define LEN_OF_SHELLNAME 50 #define MAX_SHELLS 4096 typedef struct { int ShellIndex; int CueNumber; int ShellSize; float BreakDelay; float ShellDuration; char ShellName[LEN_OF_SHELLNAME]; float ElapsedTime; } database ; database ShellCatalog[MAX_SHELLS]; I want to be able to twiddle the data from within main() or from within other functions that may be called from somewhere else. My second question is that someone mentioned in a prior post that by using malloc(), realloc(), and free(), I could reduce the memory requirements by only allocating the minimum memory required by the above array, especially if I don't use the max number of records (4096). I'm sure that by making it more memory efficient, it will run a bit faster as well. How would I implement this? All comments are appreciated and thanks for all of your help! --->Rob |
From: Scott W. <se...@al...> - 2002-10-26 03:24:28
|
Don't know if anyone responded yet but I think the answer is: Yes, unless your OS messes up. The release of the memory wasn't actually my concern, however, I just wanted to be sure memory I allocated in one part of my program was going to be available elsewhere. Scott -----Original Message----- From: Louis Godio [mailto:lg...@ya...] Sent: Friday, October 25, 2002 8:30 PM To: se...@al...; Per Westermark Cc: dev...@li... Subject: RE: [Dev-C++] dynamic allocation and structs What was the final answer to the the original question asked: "what is the duration of memory allocated by malloc (etc.)? " If not freed manually or by a destructor, Does the memory ALWAYS get released when the main() program ends with a normal exit ? --- Scott Williams <se...@al...> wrote: > Thanks for the replies to my question (and the entertaining > discussion it led to). It was all very helpful. > > Scott > > -----Original Message----- > From: Per Westermark [mailto:pw...@ia...] > Sent: Thursday, October 24, 2002 9:13 AM > To: Scott Williams > Cc: dev...@li... > Subject: Re: [Dev-C++] dynamic allocation and structs > > // Alternative 1, array of entries. > mystruct *myarray; > void func(int count) { > int i; > myarray = (mystruct*)malloc(count*sizeof(mystruct)); > for (i = 0; i < count; i++) { > myarray[i].xx = yy; > } > } > > // Alternative 2, array of pointers to entries. > mystruct **myarray; > void func(int count) { > int i; > myarray = (mystruct**)malloc(count*sizeof(*mystruct)); > for (i = 0; i < count; i++) { > myarray[i] = (mystruct*)malloc(sizeof(mystruct)); > myarray[i]->xx = yy; > } > } > > /Per W > > On Thu, 24 Oct 2002, Scott Williams wrote: > >> Hi, >> >> I'm working in C (no C++ please). Got a couple of questions >> related to dynamic allocation and in particular, dynamically >> allocating an array of structs. >> >> First, what is the duration of memory allocated by malloc >> (etc.)? In particular, I want to dynamically allocate/de- >> allocate several global variables within a single subroutine >> called from main and so want to be sure that the allocated >> memory exists beyond the scope of that subroutine. >> >> Second, it is my understanding that it is perfectly acceptable >> to have an array of structs. E.g., >> >> struct mystruct { >> double var1; >> long var2; >> etc... >> } >> >> . . . >> >> struct mystruct data[100]; >> >> Is this correct? If so, what then is the calling sequence to >> dynamically allocate an array of structs, and, in particularly, >> make the result available globally? >> >> Thanks for your help (& sorry if this is naive). >> >> Scott Williams |
From: Louis G. <lg...@ya...> - 2002-10-26 00:30:27
|
What was the final answer to the the original question asked: "what is the duration of memory allocated by malloc (etc.)? " If not freed manually or by a destructor, Does the memory ALWAYS get released when the main() program ends with a normal exit ? --- Scott Williams <se...@al...> wrote: > Thanks for the replies to my question (and the entertaining discussion > it > led to). It was all very helpful. > > Scott > > -----Original Message----- > From: Per Westermark [mailto:pw...@ia...] > Sent: Thursday, October 24, 2002 9:13 AM > To: Scott Williams > Cc: dev...@li... > Subject: Re: [Dev-C++] dynamic allocation and structs > > > > // Alternative 1, array of entries. > mystruct *myarray; > void func(int count) { > int i; > myarray = (mystruct*)malloc(count*sizeof(mystruct)); > for (i = 0; i < count; i++) { > myarray[i].xx = yy; > } > } > > // Alternative 2, array of pointers to entries. > mystruct **myarray; > void func(int count) { > int i; > myarray = (mystruct**)malloc(count*sizeof(*mystruct)); > for (i = 0; i < count; i++) { > myarray[i] = (mystruct*)malloc(sizeof(mystruct)); > myarray[i]->xx = yy; > } > } > > /Per W > > On Thu, 24 Oct 2002, Scott Williams wrote: > > > Hi, > > > > I'm working in C (no C++ please). Got a couple of questions related > to > > dynamic allocation and in particular, dynamically allocating an array > of > > structs. > > > > First, what is the duration of memory allocated by malloc (etc.)? In > > particular, I want to dynamically allocate/de-allocate several global > > variables within a single subroutine called from main and so want to > be > sure > > that the allocated memory exists beyond the scope of that subroutine. > > > > Second, it is my understanding that it is perfectly acceptable to have > an > > array of structs. E.g., > > > > struct mystruct { > > double var1; > > long var2; > > etc... > > } > > > > . . . > > > > struct mystruct data[100]; > > > > Is this correct? If so, what then is the calling sequence to > dynamically > > allocate an array of structs, and, in particularly, make the result > > available globally? > > > > Thanks for your help (& sorry if this is naive). > > > > Scott Williams > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by: Influence the future > > of Java(TM) technology. Join the Java Community > > Process(SM) (JCP(SM)) program now. > > > http://ad.doubleclick.net/clk;4729346;7592162;s?http://www.sun.com/javavote > > _______________________________________________ > > 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: Influence the future > of Java(TM) technology. Join the Java Community > Process(SM) (JCP(SM)) program now. > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en > _______________________________________________ > 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 __________________________________________________ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ |
From: Elizabeth B. <sog...@ya...> - 2002-10-25 22:26:30
|
Napoleon Ahiable <n_a...@ya...> writes: > Hello, > > I had these error message below after compilation. I will appreciate > your help, please. Also what is the general solution for the "Undefined > > reference error" message?. > > Napoleon. > > Building Makefile: "C:\Projects\DocuSort\Makefile.win" > Executing make... > mingw32-make.exe -f "C:\Projects\DocuSort\Makefile.win" all > g++.exe Main.o Class.o Maker.o Icon.o Procedure.o Commander.o View.o > MenuTable.o Cmd.o Menu.o Exception.o Ctrl.o DocuSort_private.res -o > "DocuSort.exe" -L"C:/MinGW/lib" -L"C:/Dev-Cpp/Lib" -lcomctl32 > -I"C:/MinGW/include" -I"C:/Dev-Cpp/Include" -I"C:/MinGW/include/c++" > -I"C:/MinGW/include" -I"C:/Dev-Cpp/Include" -D_WIN32_IE=0x0300 -g3 > -DSTRICT -s -mwindows Main.o: In function `ZN4Menu5MakerD2Ev': > c:/mingw/include/c++/3.2/memory(.data$_ZTVN3Win10ControllerE+0x10): > undefined reference to `Win::Controller::OnCreate(Win::CreateData > const*, bool&)' > Main.o: In function `WinMain': > C:/Projects/DocuSort/Main.cpp:9: undefined reference to > `Win::Controller::OnInitPopup(HMENU__*, int)' mingw32-make.exe: *** > [DocuSort.exe] Error 1 Execution terminated Where is your Win::Controller class located? It should be in one of the object files on the command line, like Menu.o and Exception.o. The general solution is to make sure that on object file or library that has the implementation of the function is included during the link stage, such as by adding -lwsock32 (or some other library) or a local object file. Anyway, for Dev-C++, make sure that the source file for Win::Controller has been added to the project (assuming that it is something you wrote for this particular project). Elizabeth |
From: Harry S. <har...@ho...> - 2002-10-25 22:23:51
|
When I try to check for updates and in particular to get the help files for the BETA I get the error message from vupdate "devcpp.cfg is missing". The file "devcpp.cfg" is on my computer running windows xp on a network at: C:\Documents and Settings\"my login"\Local Settings\Application Data. What do I need to do? Thanks, Harry Harry Spier 371 Brickman Rd. Hurleyville, New York USA 12747 _________________________________________________________________ Internet access plans that fit your lifestyle -- join MSN. http://resourcecenter.msn.com/access/plans/default.asp |