dev-cpp-users Mailing List for Dev-C++ (Page 55)
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: Adam J. <aj...@i-...> - 2007-07-24 03:18:01
|
Just in case you are interested, here is a platfrom independent way to = cause your program to sleep without using sleep() or MS version Sleep(). It = also avoids preprocessors commands. #include <time.h> Int main() { unsigned int clockTicks; //Stores the amount of time you want to pause execution in clock ticks clock_t ticksReached; //Stores the amount of clock ticks clockTicks =3D 3000; //set pause to 3 seconds ticksReached =3D clockTicks + clock(); //get number of clocks tick since program started then add the addition wait time while (ticksReached > clock()); //loop until current clock ticks equal the ticks needed to wait return 0; } It is more code, but it is platfrom independent and free of preprocessor commands..... -Adam Jones -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Adam = Jones Sent: Monday, July 23, 2007 10:24 PM To: 'Jamiil Abduqadir'; 'Dev Cpp MailingLinst' Subject: Re: [Dev-C++] sleep() for Windows XP >>You wrote: >> Does anyone know where I can find a source code for such service, so = that it is a portable sleep() function? Why do you feel the need to cause your program to sleep(). There may be other ways of pausing executive without using a platform dependent = command. Or using #defines. If you could provide more details, that may be = helpful. -Adam Jones From: dev...@li... [mailto:dev...@li...] On Behalf Of Jamiil Abduqadir Sent: Monday, July 23, 2007 3:37 PM To: Dev Cpp MailingLinst Subject: [Dev-C++] sleep() for Windows XP Using GCC, I developed some small apps under Linux, now I am trying to = port this apps to MSWinXP, but there are some Unix functions that are not available=A0under MS, sleep() is one of them. Does anyone know where I = can find a source code for such service, so that it is=A0a portable sleep() function? =A0 -------------------------------------------------------------------------= This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Adam J. <aj...@i-...> - 2007-07-24 02:24:30
|
>>You wrote: >> Does anyone know where I can find a source code for such service, so = that it is a portable sleep() function? Why do you feel the need to cause your program to sleep(). There may be other ways of pausing executive without using a platform dependent = command. Or using #defines. If you could provide more details, that may be = helpful. -Adam Jones From: dev...@li... [mailto:dev...@li...] On Behalf Of Jamiil Abduqadir Sent: Monday, July 23, 2007 3:37 PM To: Dev Cpp MailingLinst Subject: [Dev-C++] sleep() for Windows XP Using GCC, I developed some small apps under Linux, now I am trying to = port this apps to MSWinXP, but there are some Unix functions that are not available=A0under MS, sleep() is one of them. Does anyone know where I = can find a source code for such service, so that it is=A0a portable sleep() function? =A0 |
From: Adam J. <aj...@i-...> - 2007-07-24 02:12:31
|
>>If you have functions that returns their answers without making use of any state of a specific class, then I would recommend that you put these functions into a namespace instead >>of into a class. I agree whole hearted with this. >>Methods to a class normally perform a service based on the contents of an object, or changes the state of an object. With no involvement of an object, they are very strange >>methods. I agree again. Jamiil please note this, you will be known by the source code you produce. C++ allows you to do things you should not do, but because it allows you to do it, doesn't mean you should. Others have suggested other ways to accomplish what you need to do. It also appears that all of the advice you have been given is to avoid what you are trying to do. But having said that, it is your code. You have to make the ultimate decision. If you notice, no one here has agreed with the way you are writing the code. Most people are here to share their experience with others. Having no one agree with your implementation should cause you to rethink how you are doing it....IMHO -Adam Jones -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Per Westermark Sent: Monday, July 23, 2007 9:40 AM To: Jamiil Abduqadir Cc: dev...@li... Subject: Re: [Dev-C++] How would you write a method returning a string ? If you have functions that returns their answers without making use of any state of a specific class, then I would recommend that you put these functions into a namespace instead of into a class. Methods to a class normally perform a service based on the contents of an object, or changes the state of an object. With no involvement of an object, they are very strange methods. /pwm On Mon, 23 Jul 2007, Jamiil Abduqadir wrote: > Maize > > > Good day Matheus and Adam, I agree with what you tow have to say about a stand alone function, but I also recognize the validity of my statement. > > A class provides not only a way to hide data or polymorphism, this alone is useless unless the class or one of its derivatives provides a service. To bring my point home, let us say that class Abecedarium, provides the sound and the location of the letter in the Abecedarium, and you want to create a class that handles queries about the letters of the alphabet in the English language, well, it would be a good Idea to use Abacedarium as you base class, thus making your point valid, for in this case the hiding data and polymorphism ins an important aspect of OOP. However, this alone does not provide any service to the user, unless the creator of the either class provides a "bunch" of methods to take information in or out of the class to be processed or that has been processed respectively, thus the API of the class. And this brings me to the point of adding the method I suggested to a class. For instance > > const std::string& MyClass::Char2Str(const char* x){ return str = x;} > As Adam said, this is a waist of time 'since std::string::c_str' handles this very nicely, but what if the case is not to convert the letters from char to string alone, but to check the validity of the character-string, for instance that it does not have numbers or punctuation marks in it, inform the client of such a mistake, and so on and so forth, if the character-string is valid, then to remove any white spaces at the beginning or end of the character-string, then and only then the character-string passed as a char can be converted to a 'std::string'. If Abecedarium did not have a method(s) that would handle this operations then you will have to add it to your derived class. Which is my position on this subject. > > I would strongly recommend to add what ever function you find necessary to a particular class, MOSTLY for beginners, later on, as the beginner grows more familiar with the paradigm of OOP he or she will find that there are many classes that have the same method, which will make the new programmer create a class that will be the parent class of all those classes that have the same method, thus making his or her skills escalate from beginners to advanced. Later on, as an advance programmer, s/he will learn design and development making him or her a sort of an expert. C++ gurus are class of its own, so we don't talk about them > > I know that the are many loopholes in my brief explanation, however, time permited I have done all I can to help the C++ community. I want you to know that it has never been my intention to over shadow your opinion, which is just a valid as mine, but to only help to the best of my abilities. > > > Have a good one. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: matheus r. <mfr...@gm...> - 2007-07-23 16:41:56
|
Usually when I am in such a situation I make a wrapper function: namespace::mysleep(int t)){ #if WIN32 Sleep(t); #else sleep(t); #endif } You can also do that through defines to avoid code change. Im not sure theres a portable version of sleep, dont think its part of standard libc. I could be wrong though. > Using GCC, I developed some small apps under Linux, now I am trying to port > this apps to MSWinXP, but there are some Unix functions that are not > available under MS, sleep() is one of them. Does anyone know where I can > find a source code for such service, so that it is a portable sleep() > function? |
From: Jamiil A. <jal...@gm...> - 2007-07-23 16:33:08
|
Using GCC, I developed some small apps under Linux, now I am trying to = port this apps to MSWinXP, but there are some Unix functions that are = not available under MS, sleep() is one of them. Does anyone know where I = can find a source code for such service, so that it is a portable = sleep() function? |
From: Wagner, F. <F.W...@wi...> - 2007-07-23 15:49:36
|
Hi, thanks a lot for the fast answers. Thats what I was looking for. Greetings Frank Von: Jonathan Winterflood [mailto:jon...@gm...] Gesendet: Montag, 23. Juli 2007 15:41 An: Wagner, Frank Cc: dev...@li... Betreff: Re: [Dev-C++] Possibility to get a string out of a char* or cstr= ing Hi, I believe the fourth constructor is what you need: http://www.cppreferenc= e.com/cppstring/string_constructors.html Cheers, Jonathan On 7/23/07, Wagner, Frank <F.W...@wi...> wrote: Hi, I wrote a commandline tool that users the argv argument like -f=3Dfilename.txt. My problem is that argv is defined as char* but I would like to get the filename.txt converted to a c++ string wich comes with <string> not <cstring>. Does someone has a solution how to convert from cstring to string=3F Thanks in advance Frank -- WIKA Alexander Wiegand GmbH & Co. KG Alexander-Wiegand-Stra=DFe 30 - 63911 Klingenberg - Germany Kommanditgesellschaft: Sitz Klingenberg - Amtsgericht Aschaffenburg HRA 1= 819 Komplement=E4rin: WIKA Alexander Wiegand Verwaltungs GmbH - Sitz Klingenb= erg - Amtsgericht Aschaffenburg HRB 306 Gesch=E4ftsf=FChrer: Alexander Wiegand Telefon: (09372) 132-0 Internet: www.wika.com -- The information contained in this E-mail and any attached files are stric= tly confidential and may be subject to legal privilege. If you are not th= e intended recipient, his representative or the person responsible for de= livering the message to the intended recipient, be advised that you have = received this message in error and that any dissemination, copying or use= of this message or attachment is strictly forbidden, as is the disclosur= e of the information therein. If you have received this E-mail in error, = please notify us immediately by E-mail or telephone and delete this messa= ge and all its attachments subsequently. All reasonable precautions have = been taken to ensure no viruses are present in this E-mail. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems=3F Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users -- <Morpheus> linux, c'est une question de VI ou de MORE -- WIKA Alexander Wiegand GmbH & Co. KG Alexander-Wiegand-Stra=DFe 30 - 63911 Klingenberg - Germany Kommanditgesellschaft: Sitz Klingenberg - Amtsgericht Aschaffenburg HRA 1= 819 Komplement=E4rin: WIKA Alexander Wiegand Verwaltungs GmbH - Sitz Klingenb= erg - Amtsgericht Aschaffenburg HRB 306 Gesch=E4ftsf=FChrer: Alexander Wiegand Telefon: (09372) 132-0 Internet: www.wika.com -- The information contained in this E-mail and any attached files are stric= tly confidential and may be subject to legal privilege. If you are not th= e intended recipient, his representative or the person responsible for de= livering the message to the intended recipient, be advised that you have = received this message in error and that any dissemination, copying or use= of this message or attachment is strictly forbidden, as is the disclosur= e of the information therein. If you have received this E-mail in error, = please notify us immediately by E-mail or telephone and delete this messa= ge and all its attachments subsequently. All reasonable precautions have = been taken to ensure no viruses are present in this E-mail. |
From: Per W. <pw...@ia...> - 2007-07-23 14:23:58
|
Just construct a std::string with the zero-terminateed C string as parameter. /pwm On Mon, 23 Jul 2007, Wagner, Frank wrote: > Hi, > > I wrote a commandline tool that users the argv argument like > -f=3Dfilename.txt. > My problem is that argv is defined as char* but I would like to get the > filename.txt converted to a c++ string wich comes with <string> not > <cstring>. > Does someone has a solution how to convert from cstring to string? > > Thanks in advance > > Frank > -- > WIKA Alexander Wiegand GmbH & Co. KG > Alexander-Wiegand-Stra=DFe 30 - 63911 Klingenberg - Germany > Kommanditgesellschaft: Sitz Klingenberg - Amtsgericht Aschaffenburg HRA 1= 819 > Komplement=E4rin: WIKA Alexander Wiegand Verwaltungs GmbH - Sitz Klingenb= erg - > Amtsgericht Aschaffenburg HRB 306 > Gesch=E4ftsf=FChrer: Alexander Wiegand > Telefon: (09372) 132-0 > Internet: www.wika.com > -- > The information contained in this E-mail and any attached files are stric= tly confidential and may be subject to legal privilege. If you are not the = intended recipient, his representative or the person responsible for delive= ring the message to the intended recipient, be advised that you have receiv= ed this message in error and that any dissemination, copying or use of this= message or attachment is strictly forbidden, as is the disclosure of the i= nformation therein. If you have received this E-mail in error, please notif= y us immediately by E-mail or telephone and delete this message and all its= attachments subsequently. All reasonable precautions have been taken to en= sure no viruses are present in this E-mail. > > |
From: Jonathan W. <jon...@gm...> - 2007-07-23 13:40:53
|
Hi, I believe the fourth constructor is what you need: http://www.cppreference.com/cppstring/string_constructors.html Cheers, Jonathan On 7/23/07, Wagner, Frank <F.W...@wi...> wrote: > > Hi, > > I wrote a commandline tool that users the argv argument like > -f=3Dfilename.txt. > My problem is that argv is defined as char* but I would like to get the > filename.txt converted to a c++ string wich comes with <string> not > <cstring>. > Does someone has a solution how to convert from cstring to string? > > Thanks in advance > > Frank > -- > WIKA Alexander Wiegand GmbH & Co. KG > Alexander-Wiegand-Stra=DFe 30 - 63911 Klingenberg - Germany > Kommanditgesellschaft: Sitz Klingenberg - Amtsgericht Aschaffenburg HRA > 1819 > Komplement=E4rin: WIKA Alexander Wiegand Verwaltungs GmbH - Sitz Klingenb= erg > - > Amtsgericht Aschaffenburg HRB 306 > Gesch=E4ftsf=FChrer: Alexander Wiegand > Telefon: (09372) 132-0 > Internet: www.wika.com > -- > The information contained in this E-mail and any attached files are > strictly confidential and may be subject to legal privilege. If you are n= ot > the intended recipient, his representative or the person responsible for > delivering the message to the intended recipient, be advised that you hav= e > received this message in error and that any dissemination, copying or use= of > this message or attachment is strictly forbidden, as is the disclosure of > the information therein. If you have received this E-mail in error, pleas= e > notify us immediately by E-mail or telephone and delete this message and = all > its attachments subsequently. All reasonable precautions have been taken = to > ensure no viruses are present in this E-mail. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > --=20 <Morpheus> linux, c'est une question de VI ou de MORE |
From: Per W. <pw...@ia...> - 2007-07-23 13:40:41
|
If you have functions that returns their answers without making use of any state of a specific class, then I would recommend that you put these functions into a namespace instead of into a class. Methods to a class normally perform a service based on the contents of an object, or changes the state of an object. With no involvement of an object, they are very strange methods. /pwm On Mon, 23 Jul 2007, Jamiil Abduqadir wrote: > Maize > > > Good day Matheus and Adam, I agree with what you tow have to say about a stand alone function, but I also recognize the validity of my statement. > > A class provides not only a way to hide data or polymorphism, this alone is useless unless the class or one of its derivatives provides a service. To bring my point home, let us say that class Abecedarium, provides the sound and the location of the letter in the Abecedarium, and you want to create a class that handles queries about the letters of the alphabet in the English language, well, it would be a good Idea to use Abacedarium as you base class, thus making your point valid, for in this case the hiding data and polymorphism ins an important aspect of OOP. However, this alone does not provide any service to the user, unless the creator of the either class provides a "bunch" of methods to take information in or out of the class to be processed or that has been processed respectively, thus the API of the class. And this brings me to the point of adding the method I suggested to a class. For instance > > const std::string& MyClass::Char2Str(const char* x){ return str = x;} > As Adam said, this is a waist of time 'since std::string::c_str' handles this very nicely, but what if the case is not to convert the letters from char to string alone, but to check the validity of the character-string, for instance that it does not have numbers or punctuation marks in it, inform the client of such a mistake, and so on and so forth, if the character-string is valid, then to remove any white spaces at the beginning or end of the character-string, then and only then the character-string passed as a char can be converted to a 'std::string'. If Abecedarium did not have a method(s) that would handle this operations then you will have to add it to your derived class. Which is my position on this subject. > > I would strongly recommend to add what ever function you find necessary to a particular class, MOSTLY for beginners, later on, as the beginner grows more familiar with the paradigm of OOP he or she will find that there are many classes that have the same method, which will make the new programmer create a class that will be the parent class of all those classes that have the same method, thus making his or her skills escalate from beginners to advanced. Later on, as an advance programmer, s/he will learn design and development making him or her a sort of an expert. C++ gurus are class of its own, so we don't talk about them > > I know that the are many loopholes in my brief explanation, however, time permited I have done all I can to help the C++ community. I want you to know that it has never been my intention to over shadow your opinion, which is just a valid as mine, but to only help to the best of my abilities. > > > Have a good one. |
From: Wagner, F. <F.W...@wi...> - 2007-07-23 13:33:16
|
Hi, I wrote a commandline tool that users the argv argument like -f=3Dfilename.txt. My problem is that argv is defined as char* but I would like to get the filename.txt converted to a c++ string wich comes with <string> not <cstring>. Does someone has a solution how to convert from cstring to string=3F Thanks in advance Frank -- WIKA Alexander Wiegand GmbH & Co. KG Alexander-Wiegand-Stra=DFe 30 - 63911 Klingenberg - Germany Kommanditgesellschaft: Sitz Klingenberg - Amtsgericht Aschaffenburg HRA 1= 819 Komplement=E4rin: WIKA Alexander Wiegand Verwaltungs GmbH - Sitz Klingenb= erg - Amtsgericht Aschaffenburg HRB 306 Gesch=E4ftsf=FChrer: Alexander Wiegand Telefon: (09372) 132-0 Internet: www.wika.com -- The information contained in this E-mail and any attached files are stric= tly confidential and may be subject to legal privilege. If you are not th= e intended recipient, his representative or the person responsible for de= livering the message to the intended recipient, be advised that you have = received this message in error and that any dissemination, copying or use= of this message or attachment is strictly forbidden, as is the disclosur= e of the information therein. If you have received this E-mail in error, = please notify us immediately by E-mail or telephone and delete this messa= ge and all its attachments subsequently. All reasonable precautions have = been taken to ensure no viruses are present in this E-mail. |
From: Jonathan W. <jon...@gm...> - 2007-07-23 07:50:43
|
Hi, I believe you can add 'after' steps to the makefile Dev-cpp generates and uses in this, you could run a command/program that will beep (in a C program, puts("\b") should sound the computer's built-in speaker IIRC) you could have a look in the project options and 'makefile.win' (and look up makefile syntax probably) Jonathan On 7/23/07, Jamiil Abduqadir <jal...@gm...> wrote: > > Howdy! > Now that my program has grown, the compilation takes a few minuts, while > this is happening I usually read something or work on something else. Some > times, it just happens that Cpp-Dev has finished compiling, but I am so busy > on something else that I don't realize it. Well, I woud like to know if > Dev-Cpp has a feature that will beep me when the compilation is done, > with/without errors. > > Thanks! > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > -- <Morpheus> linux, c'est une question de VI ou de MORE |
From: Adam J. <aj...@i-...> - 2007-07-23 02:22:24
|
>> The first question to ask is: why would one need that? C++ strings >> were made thinking of them as a base value, like int. >> >> Id rather write a function with >> >> const std::string somefunction(const char *val) >> >> prototype. I agree with this prototype function. This is much safer. >> I have many classes that manipulate the string and then returns it either as >> a 'const char*', 'std::string', 'int', and so on and so forth, the method is >> just part of the class, so instead of writing a stand alone function, it is >> better to pack it up within the class, after all... that is the nature of >> Object Oriented Programming. First of all you don't need a standalone function to get a const char * from a std::string. Try std::string.c_str() it returns a const char*. Second, that is not what Object Oriented Programming is all about. Object Oriented programming is about Inheritance, Data hiding, and polymorphism. Being able to create a base class and inherit from that class to create other objects, and to be able to hide the implementation and data, along with using polymorphism. Is what OOP is all about. If you have created a class that isn't being use for inheritance, data hiding, and polymorphism, then all you have done is created a class with a bunch of functions in them. If that is the case, then that is not OOP. -Adam Jones -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Jamiil Abduqadir Sent: Sunday, July 22, 2007 11:39 PM To: matheus ribeiro Cc: dev...@li... Subject: Re: [Dev-C++] How would you write a method returning a string ? I have many classes that manipulate the string and then returns it either as a 'const char*', 'std::string', 'int', and so on and so forth, the method is just part of the class, so instead of writing a stand alone function, it is better to pack it up within the class, after all... that is the nature of Object Oriented Programming. ----- Original Message ----- From: "matheus ribeiro" <mfr...@gm...> Cc: <dev...@li...> Sent: Sunday, July 22, 2007 5:25 PM Subject: Re: [Dev-C++] How would you write a method returning a string ? > The first question to ask is: why would one need that? C++ strings > were made thinking of them as a base value, like int. > > Id rather write a function with > > const std::string somefunction(const char *val) > > prototype. > > 2007/7/22, Jamiil Abduqadir <jal...@gm...>: >> And how would you suggest one should write a method that receives a >> 'const >> char*' and returns a 'std::string&'? >> >> >> >> ----- Original Message ----- >> From: "matheus ribeiro" <mfr...@gm...> >> To: <dev...@li...> >> Sent: Sunday, July 22, 2007 8:45 AM >> Subject: Re: [Dev-C++] How would you write a method returning a string ? >> >> >> >> std::string& NameSpace::ClassName::MethodName(const char* var){return >> >> someString = var;} >> > >> > >> > Not a good idea if somestring is a function variable. It will go out >> > of scope and be destroyed, returning a ref to it will yield undefined >> > results. >> > >> > ------------------------------------------------------------------------- >> > This SF.net email is sponsored by: Splunk Inc. >> > Still grepping through log files to find problems? Stop. >> > Now Search log events and configuration files using AJAX and a browser. >> > Download your FREE copy of Splunk now >> http://get.splunk.com/ >> > _______________________________________________ >> > Dev-cpp-users mailing list >> > Dev...@li... >> > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> _______________________________________________ >> Dev-cpp-users mailing list >> Dev...@li... >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Adam J. <aj...@i-...> - 2007-07-23 01:52:59
|
>>Of course, as long as you know what youre doing, youre fine. But I >>wouldnt advice people, specially novices, doing that sort of function. I would definitely agree with that statement. You really need a good reason to do that. What you are trying to do is potentially dangerous. I would also document this in comments what you are doing, just in case other programmers use your class. There are safer ways to accomplish what you are trying to do..... :) -Adam Jones -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of matheus ribeiro Sent: Sunday, July 22, 2007 8:41 PM Cc: dev...@li... Subject: Re: [Dev-C++] How would you write a method returning a string ? > I have many classes that manipulate the string and then returns it either as > a 'const char*', 'std::string', 'int', and so on and so forth, the method is > just part of the class, so instead of writing a stand alone function, it is > better to pack it up within the class, after all... that is the nature of > Object Oriented Programming. As long as the reference you return exists, no problem. But suppose the object of the class mentioned is destroyed, your string reference will be dangling, yielding undefined results. Of course, as long as you know what youre doing, youre fine. But I wouldnt advice people, specially novices, doing that sort of function. Just MHO. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: matheus r. <mfr...@gm...> - 2007-07-23 00:41:32
|
> I have many classes that manipulate the string and then returns it either as > a 'const char*', 'std::string', 'int', and so on and so forth, the method is > just part of the class, so instead of writing a stand alone function, it is > better to pack it up within the class, after all... that is the nature of > Object Oriented Programming. As long as the reference you return exists, no problem. But suppose the object of the class mentioned is destroyed, your string reference will be dangling, yielding undefined results. Of course, as long as you know what youre doing, youre fine. But I wouldnt advice people, specially novices, doing that sort of function. Just MHO. |
From: Jamiil A. <jal...@gm...> - 2007-07-23 00:35:32
|
I have many classes that manipulate the string and then returns it either as a 'const char*', 'std::string', 'int', and so on and so forth, the method is just part of the class, so instead of writing a stand alone function, it is better to pack it up within the class, after all... that is the nature of Object Oriented Programming. ----- Original Message ----- From: "matheus ribeiro" <mfr...@gm...> Cc: <dev...@li...> Sent: Sunday, July 22, 2007 5:25 PM Subject: Re: [Dev-C++] How would you write a method returning a string ? > The first question to ask is: why would one need that? C++ strings > were made thinking of them as a base value, like int. > > Id rather write a function with > > const std::string somefunction(const char *val) > > prototype. > > 2007/7/22, Jamiil Abduqadir <jal...@gm...>: >> And how would you suggest one should write a method that receives a >> 'const >> char*' and returns a 'std::string&'? >> >> >> >> ----- Original Message ----- >> From: "matheus ribeiro" <mfr...@gm...> >> To: <dev...@li...> >> Sent: Sunday, July 22, 2007 8:45 AM >> Subject: Re: [Dev-C++] How would you write a method returning a string ? >> >> >> >> std::string& NameSpace::ClassName::MethodName(const char* var){return >> >> someString = var;} >> > >> > >> > Not a good idea if somestring is a function variable. It will go out >> > of scope and be destroyed, returning a ref to it will yield undefined >> > results. >> > >> > ------------------------------------------------------------------------- >> > This SF.net email is sponsored by: Splunk Inc. >> > Still grepping through log files to find problems? Stop. >> > Now Search log events and configuration files using AJAX and a browser. >> > Download your FREE copy of Splunk now >> http://get.splunk.com/ >> > _______________________________________________ >> > Dev-cpp-users mailing list >> > Dev...@li... >> > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> _______________________________________________ >> Dev-cpp-users mailing list >> Dev...@li... >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Jamiil A. <jal...@gm...> - 2007-07-23 00:26:39
|
Howdy! Now that my program has grown, the compilation takes a few minuts, while = this is happening I usually read something or work on something else. = Some times, it just happens that Cpp-Dev has finished compiling, but I = am so busy on something else that I don't realize it. Well, I woud like = to know if Dev-Cpp has a feature that will beep me when the compilation = is done, with/without errors. Thanks! |
From: matheus r. <mfr...@gm...> - 2007-07-23 00:26:00
|
The first question to ask is: why would one need that? C++ strings were made thinking of them as a base value, like int. Id rather write a function with const std::string somefunction(const char *val) prototype. 2007/7/22, Jamiil Abduqadir <jal...@gm...>: > And how would you suggest one should write a method that receives a 'const > char*' and returns a 'std::string&'? > > > > ----- Original Message ----- > From: "matheus ribeiro" <mfr...@gm...> > To: <dev...@li...> > Sent: Sunday, July 22, 2007 8:45 AM > Subject: Re: [Dev-C++] How would you write a method returning a string ? > > > >> std::string& NameSpace::ClassName::MethodName(const char* var){return > >> someString = var;} > > > > > > Not a good idea if somestring is a function variable. It will go out > > of scope and be destroyed, returning a ref to it will yield undefined > > results. > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Jamiil A. <jal...@gm...> - 2007-07-22 23:56:13
|
And how would you suggest one should write a method that receives a 'const char*' and returns a 'std::string&'? ----- Original Message ----- From: "matheus ribeiro" <mfr...@gm...> To: <dev...@li...> Sent: Sunday, July 22, 2007 8:45 AM Subject: Re: [Dev-C++] How would you write a method returning a string ? >> std::string& NameSpace::ClassName::MethodName(const char* var){return >> someString = var;} > > > Not a good idea if somestring is a function variable. It will go out > of scope and be destroyed, returning a ref to it will yield undefined > results. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Jamiil A. <jal...@gm...> - 2007-07-22 23:51:43
|
Yes Adam, thanks for the help, I have not tested the code or if what I think the problem is actually true, but after you pointed out that before saing "if (str->empty()){... " 'str' must point to someting, I realize that my mistake is that a declared std::string pointer does not point to anything, yet I am testing if it is empty() or not. Well I am going to go check my/your understanding of the problem and its solution. Thanks Adam. > > I haven't used Glib, but if you are getting that error, my suspicion is > that > Glib my derived it's ustring from basic_string class template, and that is > why you are getting that reference to basic_string.h. > >>> Glib::ustring* str; > > As for why you are getting the error, again my suspicion from the code > fragment is that you make a declaration for the pointer (statement above), > but you don't have it pointing to anything before you test it (statement > below). > >>> if (str->empty()){str = new Glib::ustring("Unknown");} > > You need to assign it to something. What it is pointing to is undefined. > Pointers must point to something before you can use them. Unless you have > done that in code you have not shown us. > > -Adam Jones > > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Jamiil > Abduqadir > Sent: Saturday, July 21, 2007 11:52 PM > To: Per Westermark > Cc: 'Dev Cpp MailingLinst' > Subject: Re: [Dev-C++] Segmentation Fault - Debugging > > Per and Adam, thank you very much for the hand. > Using Per's suggetion I used the DOS prompt to run gdb and tb, and as > requested by Adam, here is the slice of code that is causing all the > problems. > hpp file > #include <glibmm/ustring.h> > .... > Glib::ustring* str; > ... > cpp file > if (str->empty()){str = new Glib::ustring("Unknown");} > ... > > 'gdb' reports that the error is in basic_string.h, line 261. I am > compiling > using mingw32 v 3.4.4 > In a WinXP machine. > What has me comfused is that I am not using the std library, but the Glib > library; yet the error comes from the std library > Can anyone help? > ----- Original Message ----- > From: "Per Westermark" <pw...@ia...> > To: "Jamiil Abduqadir" <jal...@gm...> > Cc: "Adam Jones" <aj...@i-...>; "'Dev Cpp MailingLinst'" > <dev...@li...> > Sent: Saturday, July 21, 2007 11:12 AM > Subject: Re: [Dev-C++] Segmentation Fault - Debugging > > >>I never use the built-in debugger support in Dev-C++, but if you can get >> the application to fail in the debugger - or by running directly from gdb >> om command line, the back trace command (bt in command line version) will >> dump the call sequence where the application died. >> >> /pwm >> >> On Sat, 21 Jul 2007, Jamiil Abduqadir wrote: >> >>> Well, I would like to give you more information, but my problem is that >>> I >>> don't know how to utilize Dev-Cpp's debugger to locate the problem. If >>> you >>> know a trick to catch the problemed code, please let me know. >>> >>> Thanks in advance. >>> ----- Original Message ----- >>> From: "Adam Jones" <aj...@i-...> >>> To: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'" >>> <dev...@li...> >>> Sent: Saturday, July 21, 2007 5:47 AM >>> Subject: RE: [Dev-C++] Segmentation Fault - Debugging >>> >>> >>> You Wrote: >>> > I have a segmentation fault in my program >>> >>> This usually indicates a pointer allocation problem. Check your pointers >>> in >>> your program. Make sure they are allocated and initialized correctly >>> before >>> using them. Without out knowing more about the code or what you are >>> doing, >>> this is the only advice I can give at this point. >>> >>> -Adam Jones >>> >>> >>> From: dev...@li... >>> [mailto:dev...@li...] On Behalf Of Jamiil >>> Abduqadir >>> Sent: Saturday, July 21, 2007 10:37 AM >>> To: Dev Cpp MailingLinst >>> Subject: [Dev-C++] Segmentation Fault - Debugging >>> >>> Hello. >>> I have a segmentation fault in my program, I know that I could trace, or >>> back trace in this case, to find where the the segmentation fault >>> occures. >>> What I don't know, though, how to do it. >>> Can someone please point me out where I can get this information, or >>> tell >>> how to do it under Dev-Cpp? >>> >>> Thanks everyone. >>> >>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by: Splunk Inc. >>> Still grepping through log files to find problems? Stop. >>> Now Search log events and configuration files using AJAX and a browser. >>> Download your FREE copy of Splunk now >> http://get.splunk.com/ >>> _______________________________________________ >>> Dev-cpp-users mailing list >>> Dev...@li... >>> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >>> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >>> >> > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Adam J. <aj...@i-...> - 2007-07-22 16:36:14
|
>> You wrote: >> 'gdb' reports that the error is in basic_string.h, line 261. I am compiling >> using mingw32 v 3.4.4 >> In a WinXP machine. >> What has me comfused is that I am not using the std library, but the Glib >> library; yet the error comes from the std library I haven't used Glib, but if you are getting that error, my suspicion is that Glib my derived it's ustring from basic_string class template, and that is why you are getting that reference to basic_string.h. >> Glib::ustring* str; As for why you are getting the error, again my suspicion from the code fragment is that you make a declaration for the pointer (statement above), but you don't have it pointing to anything before you test it (statement below). >> if (str->empty()){str = new Glib::ustring("Unknown");} You need to assign it to something. What it is pointing to is undefined. Pointers must point to something before you can use them. Unless you have done that in code you have not shown us. -Adam Jones -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Jamiil Abduqadir Sent: Saturday, July 21, 2007 11:52 PM To: Per Westermark Cc: 'Dev Cpp MailingLinst' Subject: Re: [Dev-C++] Segmentation Fault - Debugging Per and Adam, thank you very much for the hand. Using Per's suggetion I used the DOS prompt to run gdb and tb, and as requested by Adam, here is the slice of code that is causing all the problems. hpp file #include <glibmm/ustring.h> .... Glib::ustring* str; ... cpp file if (str->empty()){str = new Glib::ustring("Unknown");} ... 'gdb' reports that the error is in basic_string.h, line 261. I am compiling using mingw32 v 3.4.4 In a WinXP machine. What has me comfused is that I am not using the std library, but the Glib library; yet the error comes from the std library Can anyone help? ----- Original Message ----- From: "Per Westermark" <pw...@ia...> To: "Jamiil Abduqadir" <jal...@gm...> Cc: "Adam Jones" <aj...@i-...>; "'Dev Cpp MailingLinst'" <dev...@li...> Sent: Saturday, July 21, 2007 11:12 AM Subject: Re: [Dev-C++] Segmentation Fault - Debugging >I never use the built-in debugger support in Dev-C++, but if you can get > the application to fail in the debugger - or by running directly from gdb > om command line, the back trace command (bt in command line version) will > dump the call sequence where the application died. > > /pwm > > On Sat, 21 Jul 2007, Jamiil Abduqadir wrote: > >> Well, I would like to give you more information, but my problem is that I >> don't know how to utilize Dev-Cpp's debugger to locate the problem. If >> you >> know a trick to catch the problemed code, please let me know. >> >> Thanks in advance. >> ----- Original Message ----- >> From: "Adam Jones" <aj...@i-...> >> To: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'" >> <dev...@li...> >> Sent: Saturday, July 21, 2007 5:47 AM >> Subject: RE: [Dev-C++] Segmentation Fault - Debugging >> >> >> You Wrote: >> > I have a segmentation fault in my program >> >> This usually indicates a pointer allocation problem. Check your pointers >> in >> your program. Make sure they are allocated and initialized correctly >> before >> using them. Without out knowing more about the code or what you are >> doing, >> this is the only advice I can give at this point. >> >> -Adam Jones >> >> >> From: dev...@li... >> [mailto:dev...@li...] On Behalf Of Jamiil >> Abduqadir >> Sent: Saturday, July 21, 2007 10:37 AM >> To: Dev Cpp MailingLinst >> Subject: [Dev-C++] Segmentation Fault - Debugging >> >> Hello. >> I have a segmentation fault in my program, I know that I could trace, or >> back trace in this case, to find where the the segmentation fault >> occures. >> What I don't know, though, how to do it. >> Can someone please point me out where I can get this information, or tell >> how to do it under Dev-Cpp? >> >> Thanks everyone. >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> _______________________________________________ >> Dev-cpp-users mailing list >> Dev...@li... >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> > ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: matheus r. <mfr...@gm...> - 2007-07-22 15:45:42
|
> std::string& NameSpace::ClassName::MethodName(const char* var){return > someString = var;} Not a good idea if somestring is a function variable. It will go out of scope and be destroyed, returning a ref to it will yield undefined results. |
From: Jamiil A. <jal...@gm...> - 2007-07-22 11:00:33
|
----- Original Message ----- From: "Per Westermark" <pw...@ia...> To: "Hiroyuki Yamada" <yam...@gm...> Cc: <dev...@li...> Sent: Saturday, July 21, 2007 11:16 AM Subject: Re: [Dev-C++] How would you write a method returning a string ? > Yes, the stdd:string type is bigger than a pointer, since it contains more > than a pointer. It also contains (at least) a length and a reference > counter. std::string& NameSpace::ClassName::MethodName(const char* var){return someString = var;} or const char* NameSpace::ClassName::MethodName(std::string& str){return str.c_str();} > > Assigning one std::string to another does not normally require a copy of > the text data. A normal implementation of std::string uses a > reference-counted buffer for the text data, and a new std::string will > just point to the same text. > > /pwm > > On Sun, 22 Jul 2007, Hiroyuki Yamada wrote: > >> Hi, >> >> I'm wondering how you would write a method returning a string. >> >> In C, we usually return char * which malloced in the function or >> returning char * which is static in the function. >> (We should free the char * in the first case.) >> >> In C++, >> we have std::string, so i'm not sure what to do with it to return string. >> >> What I'm trying to do as following. >> >> 1. use char * as a return value just like C >> 2. use std::string as a return value (copying the string object) >> 3. use std::string reference as one of the arguments (return value is >> bool or something.) >> 4. use std::string reference as a return value >> >> There should be more ways, but I'm not familier with those (teach me >> those please) >> and I don't know what's the best. >> I'm going to use method 2 because >> it's simple and copying string object is not a much cost I think. >> (It's said that string object is 7 times as big as the pointer >> size(4bytes) at the biggest in Effective STL) >> >> Please let me know how you would write to return string. >> >> >> Thanks, >> >> HIroyuki Yamada >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2005. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Dev-cpp-users mailing list >> Dev...@li... >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Jamiil A. <jal...@gm...> - 2007-07-22 00:48:36
|
Per and Adam, thank you very much for the hand. Using Per's suggetion I used the DOS prompt to run gdb and tb, and as requested by Adam, here is the slice of code that is causing all the problems. hpp file #include <glibmm/ustring.h> .... Glib::ustring* str; ... cpp file if (str->empty()){str = new Glib::ustring("Unknown");} ... 'gdb' reports that the error is in basic_string.h, line 261. I am compiling using mingw32 v 3.4.4 In a WinXP machine. What has me comfused is that I am not using the std library, but the Glib library; yet the error comes from the std library Can anyone help? ----- Original Message ----- From: "Per Westermark" <pw...@ia...> To: "Jamiil Abduqadir" <jal...@gm...> Cc: "Adam Jones" <aj...@i-...>; "'Dev Cpp MailingLinst'" <dev...@li...> Sent: Saturday, July 21, 2007 11:12 AM Subject: Re: [Dev-C++] Segmentation Fault - Debugging >I never use the built-in debugger support in Dev-C++, but if you can get > the application to fail in the debugger - or by running directly from gdb > om command line, the back trace command (bt in command line version) will > dump the call sequence where the application died. > > /pwm > > On Sat, 21 Jul 2007, Jamiil Abduqadir wrote: > >> Well, I would like to give you more information, but my problem is that I >> don't know how to utilize Dev-Cpp's debugger to locate the problem. If >> you >> know a trick to catch the problemed code, please let me know. >> >> Thanks in advance. >> ----- Original Message ----- >> From: "Adam Jones" <aj...@i-...> >> To: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'" >> <dev...@li...> >> Sent: Saturday, July 21, 2007 5:47 AM >> Subject: RE: [Dev-C++] Segmentation Fault - Debugging >> >> >> You Wrote: >> > I have a segmentation fault in my program >> >> This usually indicates a pointer allocation problem. Check your pointers >> in >> your program. Make sure they are allocated and initialized correctly >> before >> using them. Without out knowing more about the code or what you are >> doing, >> this is the only advice I can give at this point. >> >> -Adam Jones >> >> >> From: dev...@li... >> [mailto:dev...@li...] On Behalf Of Jamiil >> Abduqadir >> Sent: Saturday, July 21, 2007 10:37 AM >> To: Dev Cpp MailingLinst >> Subject: [Dev-C++] Segmentation Fault - Debugging >> >> Hello. >> I have a segmentation fault in my program, I know that I could trace, or >> back trace in this case, to find where the the segmentation fault >> occures. >> What I don't know, though, how to do it. >> Can someone please point me out where I can get this information, or tell >> how to do it under Dev-Cpp? >> >> Thanks everyone. >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> _______________________________________________ >> Dev-cpp-users mailing list >> Dev...@li... >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> > |
From: Per W. <pw...@ia...> - 2007-07-21 18:16:19
|
Yes, the stdd:string type is bigger than a pointer, since it contains more than a pointer. It also contains (at least) a length and a reference counter. Assigning one std::string to another does not normally require a copy of the text data. A normal implementation of std::string uses a reference-counted buffer for the text data, and a new std::string will just point to the same text. /pwm On Sun, 22 Jul 2007, Hiroyuki Yamada wrote: > Hi, > > I'm wondering how you would write a method returning a string. > > In C, we usually return char * which malloced in the function or > returning char * which is static in the function. > (We should free the char * in the first case.) > > In C++, > we have std::string, so i'm not sure what to do with it to return string. > > What I'm trying to do as following. > > 1. use char * as a return value just like C > 2. use std::string as a return value (copying the string object) > 3. use std::string reference as one of the arguments (return value is > bool or something.) > 4. use std::string reference as a return value > > There should be more ways, but I'm not familier with those (teach me > those please) > and I don't know what's the best. > I'm going to use method 2 because > it's simple and copying string object is not a much cost I think. > (It's said that string object is 7 times as big as the pointer > size(4bytes) at the biggest in Effective STL) > > Please let me know how you would write to return string. > > > Thanks, > > HIroyuki Yamada > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Per W. <pw...@ia...> - 2007-07-21 18:12:24
|
I never use the built-in debugger support in Dev-C++, but if you can get the application to fail in the debugger - or by running directly from gdb om command line, the back trace command (bt in command line version) will dump the call sequence where the application died. /pwm On Sat, 21 Jul 2007, Jamiil Abduqadir wrote: > Well, I would like to give you more information, but my problem is that I > don't know how to utilize Dev-Cpp's debugger to locate the problem. If you > know a trick to catch the problemed code, please let me know. > > Thanks in advance. > ----- Original Message ----- > From: "Adam Jones" <aj...@i-...> > To: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'" > <dev...@li...> > Sent: Saturday, July 21, 2007 5:47 AM > Subject: RE: [Dev-C++] Segmentation Fault - Debugging > > > You Wrote: > > I have a segmentation fault in my program > > This usually indicates a pointer allocation problem. Check your pointers in > your program. Make sure they are allocated and initialized correctly before > using them. Without out knowing more about the code or what you are doing, > this is the only advice I can give at this point. > > -Adam Jones > > > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Jamiil > Abduqadir > Sent: Saturday, July 21, 2007 10:37 AM > To: Dev Cpp MailingLinst > Subject: [Dev-C++] Segmentation Fault - Debugging > > Hello. > I have a segmentation fault in my program, I know that I could trace, or > back trace in this case, to find where the the segmentation fault occures. > What I don't know, though, how to do it. > Can someone please point me out where I can get this information, or tell > how to do it under Dev-Cpp? > > Thanks everyone. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |