dev-cpp-users Mailing List for Dev-C++ (Page 530)
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: Ramana K. <ra...@my...> - 2002-09-05 13:21:51
|
create your pointer like this: void (* funcPtr) ();
void is the return type, in the () is contained the arguments.
you then assign the pointer like: funcPtr = MyFunction;
then call it like: funcPtr();
you should be able to create this pointer as a private (or public) member
data, and assign it in member function code, or other function code.
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Stein Nygård
Sent: Thursday, 5 September 2002 2:07 AM
To: DevCpp
Subject: [Dev-C++] functionpointers within a class
Hi!
I'm having some trouble, with my pointers...
I would like to make a class, and it should contain several functions and
a pointer which will point at any of these functions. All functions would be
of type void ;) The functions must be able to set the value of the pointer,
to any of the other functions... making sense? Sure hope so!
any help? Thanks!
Stein Nygård - http://steinware.dk
lapido, ergo sum
|
|
From: Per W. <pw...@ia...> - 2002-09-05 12:41:38
|
Make the following changes, and it will work. A pointer is just that. A pointer to a block of memory. To use it, you also must make the pointer point to some available memory. An unininitalized pointer may point anywhere inside the computer, thereby resulting in a crash when the program tries to follow the pointer for either reading or writing. Cheers /Per Westermark EMA System email: pw...@ia... Per Westermark web: http://iapetus.neab.net Vargvaegen 174B phone: +46 8 410 17 198 S-906 42 Umeaa Sweden On Thu, 5 Sep 2002, Christian Wallukat wrote: > Hi Carlos , > > > sorry, but i send the wrong snipped (one of the trys)... > > If I execute it as follows, it crashes... > > Any idea ? > > > > > > #include "stdio.h" > #include "fstream.h" > #include "windows.h" > > > > int main(int argc, char* argv[]) > { > BYTE * buffer; > int nRead = 0; > > buffer = new BYTE[2048]; > ifstream *fb = new ifstream; > fb->open("c:\\out.cal"); > > > if(fb->fail() != 0)printf("Cant opne\n"); > > > fb->seekg(0); > > > while (!fb->eof()) > { > fb->read(buffer, 2048); > nRead = nRead + 2048; > printf("%i\n", nRead); > }; delete[] buffer; > > > getchar(); > return 0; > } > > > > If I execute this I get an acces voilation after the read function ... > > > > Does any one have an idea ? > > > > Kind r > > > > Christian > > > ------------------------------------------------------- > This sf.net email is sponsored by: OSDN - Tired of that same old > cell phone? Get a new here for FREE! > https://www.inphonic.com/r.asp?r=sourceforge1 > <https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390> > &refcode1=vs3390 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > <http://www.noicys.cjb.net/devcpp/ub.htm> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > <https://lists.sourceforge.net/lists/listinfo/dev-cpp-users> > > > > ------------------------------------------------------- > This sf.net email is sponsored by: OSDN - Tired of that same old > cell phone? Get a new here for FREE! > https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Ioannis V. <no...@ho...> - 2002-09-05 11:48:47
|
>From: senem beken <sbe...@ya...>
>To: dev...@li...
>Subject: [Dev-C++] q3??
>Date: Thu, 5 Sep 2002 02:49:38 -0700 (PDT)
>#include <iostream>
>#include <stdlib.h>
Or better: #include <cstdlib>
>int main()
>{
> int nrows,ncolumns;
> nrows=ncolumns=5;
> int **arr=new int*[nrows];
> for(int i=0;i<ncolumns;i++) //why do i have to use a for loop
> arr[i]=new int[ncolumns]; //to create a multiple subs array
> // dynamically??
> //why can't i use a code like:
> //int **arr=new int*[nrows];
> // *arr=new int[ncolumns]; ???
You can:
#include <iostream>
#include <vector>
int main() try
{
using std::vector;
int (*p)[50];
// Creates an 100x50 array on the free store
p=new int[100][50];
delete[] p;
// A second way:
typedef int array[50];
// Creates an 100x50 array on the free store
array *r=new array[100];
delete[] r;
// Creates a 100x50 vector. Prefer this
vector<vector<int> >s(100, vector<int>(50));
// s clears itself automatically at the end of its scope.
}
catch(std::bad_alloc)
{
std::cerr<<"I think i saw a catty!\n";
}
>
>
> for(int i=0;i<nrows;i++)
> for(int j=0;j<ncolumns;j++)
> arr[i][j]=0;
>
> for(int i=0;i<nrows;i++)
> for(int j=0;j<ncolumns;j++)
> cout<<arr[i][j]<<" ";
>
> cout<<sizeof(arr)/sizeof(int)<<endl; //and why does this part
return
>1
> //instead of 25??
Because it is equivallent of the expresion sizeof(int **)/sizeof(int)
which obviously happen to have the same size.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|
|
From: Christian W. <Chr...@vo...> - 2002-09-05 11:45:16
|
Hi Carlos ,
sorry, but i send the wrong snipped (one of the trys)...
If I execute it as follows, it crashes...
Any idea ?
#include "stdio.h"
#include "fstream.h"
#include "windows.h"
int main(int argc, char* argv[])
{
BYTE * buffer;
int nRead = 0;
ifstream *fb = new ifstream;
fb->open("c:\\out.cal");
if(fb->fail() != 0)printf("Cant opne\n");
fb->seekg(0);
while (!fb->eof())
{
fb->read(buffer, 2048);
nRead = nRead + 2048;
printf("%i\n", nRead);
};
getchar();
return 0;
}
If I execute this I get an acces voilation after the read function ...
Does any one have an idea ?
Kind r
Christian
-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1
<https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390>
&refcode1=vs3390
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
<http://www.noicys.cjb.net/devcpp/ub.htm>
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
<https://lists.sourceforge.net/lists/listinfo/dev-cpp-users>
|
|
From: Carlos d. M. <cg...@wo...> - 2002-09-05 11:29:47
|
You say char buffer, it shall be char *buffer, the function expects a poi=
nter.
Christian Wallukat escribi=F3:
> Hi List,
>
>
> i have a problem readding a binary file.
>
> I have a 1.3 MB File, and i hav to read 2048 bytes (if !=3D eof),
>
> if have tryed it with ReadFile() but i every time get an acces violatio=
n ...
>
> My last try was ifstream:
>
>
> #include "stdio.h"
> #include "fstream.h"
> #include "windows.h"
>
>
> int main(int argc, char* argv[])
> {
> char buffer;
> int nRead =3D 0;
>
> ifstream *fb =3D new ifstream;
> fb->open("c:\\out.cal");
>
> if(fb->fail() !=3D 0)printf("Cant opne\n");
>
> fb->seekg(0);
>
> while (!fb->eof())
> {
> fb->read(buffer, 2048);
> nRead =3D nRead + 2048;
> printf("%i\n", nRead);
> };
>
> getchar();
> return 0;
> }
>
>
> If I execute this I get an acces voilation after the read function ...
>
>
> Does any one have an idea ?
>
>
> Kind r
>
>
> Christian
>
> -------------------------------------------------------
> This sf.net email is sponsored by: OSDN - Tired of that same old
> cell phone? Get a new here for FREE!
> https://www.inphonic.com/r.asp?r=3Dsourceforge1&refcode1=3Dvs3390
> _______________________________________________
> 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: <ra...@am...> - 2002-09-05 11:20:33
|
Hello,
I'm experimenting with the fltk gui toolkit that comes with Dev-C++ and I'm
puzzled with the Fl_Text_Editor object. The Fl_Text_Editor becomes visible
only when I start typing in it! Here is the code I use:
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Text_Editor.H>
#include <FL/Fl_Text_Buffer.H>
int
main (int argc, char *argv[])
{
Fl_Window *window;
Fl_Text_Editor *editor;
Fl_Text_Buffer *textbuf;
window = new Fl_Window (600, 600);
textbuf = new Fl_Text_Buffer(1024);
editor = new Fl_Text_Editor(10, 150, 300, 300);
editor->buffer(textbuf);
editor->take_focus();
window->end ();
window->show (argc, argv);
return Fl::run();
}
What am I missing?
__|||__
@(° °)@
----------------------------oOO--(_)--OOo----------------------------
Raphaël Bollen
Project engineer
Ampco Belgium
http://www.ampcobelgium.be
http://www.audiodeal.net
mailto:ra...@am...
Hoek 76, unit 72
2850 Boom
TEL.: 03 844 67 97
FAX: 03 844 67 46
|
|
From: Carlos d. M. <cg...@wo...> - 2002-09-05 11:18:03
|
Did you include a header with each menuitem value? Did you include <windows.h>? The values of the defines from the header are correct? If your resource file is not rsrc.rc, did you put the name of it in project options -> resource files? Vlada Djurovic escribi=F3: > Hi ! > > I have very frustrating problem: I wrote an .rc file containing menu > definition, added it to project, everything compiled OK, but when I > run the application, I don=92t get menu on it. Everything else seems OK > except this. What=92s wrong? > > Any help is appriciated. > |
|
From: Vlada D. <dj...@im...> - 2002-09-05 10:44:58
|
Hi ! I have very frustrating problem: I wrote an .rc file containing menu definition, added it to project, everything compiled OK, but when I run the application, I don=92t get menu on it. Everything else seems OK = except this. What=92s wrong? Any help is appriciated. |
|
From: Christian W. <Chr...@vo...> - 2002-09-05 10:26:54
|
Hi List,
i have a problem readding a binary file.
I have a 1.3 MB File, and i hav to read 2048 bytes (if != eof),
if have tryed it with ReadFile() but i every time get an acces violation ...
My last try was ifstream:
#include "stdio.h"
#include "fstream.h"
#include "windows.h"
int main(int argc, char* argv[])
{
char buffer;
int nRead = 0;
ifstream *fb = new ifstream;
fb->open("c:\\out.cal");
if(fb->fail() != 0)printf("Cant opne\n");
fb->seekg(0);
while (!fb->eof())
{
fb->read(buffer, 2048);
nRead = nRead + 2048;
printf("%i\n", nRead);
};
getchar();
return 0;
}
If I execute this I get an acces voilation after the read function ...
Does any one have an idea ?
Kind r
Christian
|
|
From: Daniel G. <sp...@ho...> - 2002-09-05 09:59:50
|
Quick guess, I think you need the for loop to create an array of pointers or
something. Your suggested method would only have one pointer, and then you'd
need to store the addresses of the arrays and/or their data.
Just a quick guess, could be well off.
>From: senem beken <sbe...@ya...>
>To: dev...@li...
>Subject: [Dev-C++] q3??
>Date: Thu, 5 Sep 2002 02:49:38 -0700 (PDT)
>
>
>
>
>include <iostream>
>#include <stdlib.h>
>
>int main()
>{
> int nrows,ncolumns;
> nrows=ncolumns=5;
> int **arr=new int*[nrows];
> for(int i=0;i<ncolumns;i++) //why do i have to use a for loop
> arr[i]=new int[ncolumns]; //to create a multiple subs array
> // dynamically??
> //why can't i use a code like:
> //int **arr=new int*[nrows];
> // *arr=new int[ncolumns]; ???
>
>
> for(int i=0;i<nrows;i++)
> for(int j=0;j<ncolumns;j++)
> arr[i][j]=0;
>
> for(int i=0;i<nrows;i++)
> for(int j=0;j<ncolumns;j++)
> cout<<arr[i][j]<<" ";
>
> cout<<sizeof(arr)/sizeof(int)<<endl; //and why does this part return
>1
> //instead of 25??
> cout<<nrows<<" "<<ncolumns<<endl;
> system("PAUSE");
> return 0;
>}
>
>
>
>---------------------------------
>Do You Yahoo!?
>Yahoo! Finance - Get real-time stock quotes
_________________________________________________________________
Join the worlds largest e-mail service with MSN Hotmail.
http://www.hotmail.com
|
|
From: senem b. <sbe...@ya...> - 2002-09-05 09:51:08
|
include <iostream>
#include <stdlib.h>
int main()
{
int nrows,ncolumns;
nrows=ncolumns=5;
int **arr=new int*[nrows];
for(int i=0;i<ncolumns;i++) //why do i have to use a for loop
arr[i]=new int[ncolumns]; //to create a multiple subs array
// dynamically??
//why can't i use a code like:
//int **arr=new int*[nrows];
// *arr=new int[ncolumns]; ???
for(int i=0;i<nrows;i++)
for(int j=0;j<ncolumns;j++)
arr[i][j]=0;
for(int i=0;i<nrows;i++)
for(int j=0;j<ncolumns;j++)
cout<<arr[i][j]<<" ";
cout<<sizeof(arr)/sizeof(int)<<endl; //and why does this part return 1
//instead of 25??
cout<<nrows<<" "<<ncolumns<<endl;
system("PAUSE");
return 0;
}
---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes |
|
From: senem b. <sbe...@ya...> - 2002-09-05 09:49:39
|
include <iostream>
#include <stdlib.h>
int main()
{
int nrows,ncolumns;
nrows=ncolumns=5;
int **arr=new int*[nrows];
for(int i=0;i<ncolumns;i++) //why do i have to use a for loop
arr[i]=new int[ncolumns]; //to create a multiple subs array
// dynamically??
//why can't i use a code like:
//int **arr=new int*[nrows];
// *arr=new int[ncolumns]; ???
for(int i=0;i<nrows;i++)
for(int j=0;j<ncolumns;j++)
arr[i][j]=0;
for(int i=0;i<nrows;i++)
for(int j=0;j<ncolumns;j++)
cout<<arr[i][j]<<" ";
cout<<sizeof(arr)/sizeof(int)<<endl; //and why does this part return 1
//instead of 25??
cout<<nrows<<" "<<ncolumns<<endl;
system("PAUSE");
return 0;
}
---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes |
|
From: Daniel G. <sp...@ho...> - 2002-09-05 09:34:01
|
Don't you have to create a virtual table? >From: Stein Nygård <st...@nu...> >To: "DevCpp" <dev...@li...> >Subject: [Dev-C++] functionpointers within a class >Date: Wed, 4 Sep 2002 18:07:26 +0200 > >Hi! > >I'm having some trouble, with my pointers... >I would like to make a class, and it should contain several functions and a >pointer which will point at any of these functions. All functions would be >of type void ;) The functions must be able to set the value of the pointer, >to any of the other functions... making sense? Sure hope so! > >any help? Thanks! > > Stein Nygård - http://steinware.dk >lapido, ergo sum _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com |
|
From: Ioannis V. <no...@ho...> - 2002-09-04 23:50:52
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of h.r...@gm...
> Sent: Thursday, September 05, 2002 1:20 AM
> To: dev...@li...
> Subject: [Dev-C++] stl accumulate question
>
>
> Hi list,
>
> i want to replace the following code:
>
> typedef vector<double>::iterator it;
>
> for(it i = TMW.begin(); i != TMW.end(); i++) {
> sx += *i;
> sxx += sqr(*i);
> }
>
> with
>
> sx = accumulate(TMW.begin(), TMW.end(), 0.0);
> sxx = accumulate(TMW.begin(), TMW.end(), 0.0, sqr);
> [...]
>
> def of sqr:
>
> template<class T>
> inline T sqr(T x) { return x * x; }
>
> but sxx = .... does not compile.
>
> The error message:
> 55 E:\dev\dev-c++\proj2\procabi.cpp
> no matching function for call to `accumulate (double *,
> double *, double,
> {unknown type})'
>
> Why that ???
#include <numeric>
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|
|
From: Cesar R. <cs...@uo...> - 2002-09-04 22:36:01
|
Thomas Kurz wrote: > > Hi Cesar, > you got the latest version of the .exe, but because of the new features > (Tip of the Day) you have to get the newest language and tip files as well! > Not all languages are available at once, but the most get updated quite > quickly. > Thank you very much Thomas! With your information I managed to locate and add (in my native tongue ;-) the strings that were lacking in the language file and now I have the entries and the phrase 'tip of the day' available! BTW, to whom may I send the six lines so the language file Portuguese have this set? Again thanks and best regards, -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/ |
|
From: <h.r...@gm...> - 2002-09-04 22:20:27
|
Hi list,
i want to replace the following code:
typedef vector<double>::iterator it;
for(it i = TMW.begin(); i != TMW.end(); i++) {
sx += *i;
sxx += sqr(*i);
}
with
sx = accumulate(TMW.begin(), TMW.end(), 0.0);
sxx = accumulate(TMW.begin(), TMW.end(), 0.0, sqr);
[...]
def of sqr:
template<class T>
inline T sqr(T x) { return x * x; }
but sxx = .... does not compile.
The error message:
55 E:\dev\dev-c++\proj2\procabi.cpp
no matching function for call to `accumulate (double *, double *, double,
{unknown type})'
Why that ???
Thanks in advance
greetings
Horst
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
|
|
From: Thomas K. <tho...@gm...> - 2002-09-04 18:42:28
|
Hi Cesar, you got the latest version of the .exe, but because of the new features (Tip of the Day) you have to get the newest language and tip files as well! Not all languages are available at once, but the most get updated quite quickly. Thomas > The present version of dev-cpp (4.9.5.2) when starts just after the > splash screen shows an information screen with two error messages. > > It is even available after closing it in the Help menu as an entry <ERR: > 2700> complete with accelerator key! > > Is this a symptom my installation gone broken or missing any utility? |
|
From: <st...@nu...> - 2002-09-04 16:07:27
|
Hi!
I'm having some trouble, with my pointers...
I would like to make a class, and it should contain several functions =
and a pointer which will point at any of these functions. All functions =
would be of type void ;) The functions must be able to set the value of =
the pointer, to any of the other functions... making sense? Sure hope =
so!
any help? Thanks!
Stein Nyg=E5rd - http://steinware.dk
lapido, ergo sum
|
|
From: Napoleon A. <nah...@so...> - 2002-09-04 15:46:15
|
Hello,
Please I have this error that i need help with:
In file included from Nodes.h:5,
from Nodes.cpp:1:
AutoVector.h:11: no class template named `iterator' in `std'
make.exe: *** [Nodes.o]
Error 1 Execution terminated
I have tried #include <Iterator.h> and also checked if the file Iterator was
present in /g++-3 and it was. The section of code with the problem is:
template<class T>
class const_auto_iterator: public
std::iterator<std::forward_iterator_tag, T const *>
{
public:
const_auto_iterator () : _pp (0) {}
const_auto_iterator (std::auto_ptr<T> const * p) : _pp (p) {}
bool operator != (const_auto_iterator<T> const & it) const
{ return it._pp != _pp; }
bool operator == (const_auto_iterator<T> const & it) const
{ return it._pp == _pp; }
const_auto_iterator operator++ (int) { return _pp++; }
const_auto_iterator operator++ () { return ++_pp; }
T const * operator * () { return _pp->get (); }
T const * operator-> () { return _pp->get (); }
private:
std::auto_ptr<T> const * _pp;
};
Thanks
Napoleon.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.384 / Virus Database: 216 - Release Date: 21/08/2002
|
|
From: Cesar R. <cs...@uo...> - 2002-09-04 14:53:40
|
The present version of dev-cpp (4.9.5.2) when starts just after the splash screen shows an information screen with two error messages. It is even available after closing it in the Help menu as an entry <ERR: 2700> complete with accelerator key! Is this a symptom my installation gone broken or missing any utility? -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/ |
|
From: Carlos d. M. <cg...@wo...> - 2002-09-03 19:09:00
|
The point is that with realloc, if it succeeds the original memory pointe=
d by
the argument pointer is freed and so you can forget it and work with the =
new,
but if it fails, then the memory pointed to by the argument pointer remai=
ns
valid, and if you use that same pointer as return value, then you get tha=
t the
pointer is no more pointing to that piece of still valid memory, and, how=
you
free it? it will be annoying your program.
The moral of the story is, don't use the same pointer as argument and ret=
urn
value of realloc.
If it fails, if(!returnpointer) work with the original and free(original)
if it succeeds else work with the new and forget the old.
Abhijit Shylanath escribi=F3:
> Greets, Carlos.
>
> ----- Original Message -----
>
> DON'T USE MALLOC()/CALLOC()/REALLOC() IN C++ PROGRAMS! ONLY IN C.
> WITH ALL THE HIGHLIGHTED WORDS MALLOC FOR C, NEW FOR C++ (WITH THE
> CORRESPONDENT "LIBERATORS")
> Now regarding realloc():
> If it manages to change the size at the current location it returns the
> same pointer you passed to it. If it allocates space somewhere else, it
> moves the contents there and frees the current space. In case it fails,
> it returns NULL and the current memory address remains unchanged.
> In summary, if it fails you have the old memory area. If it doesn't fai=
l
> use the returned pointer and forget the old one. Example:
> /* C code */
> int *p=3Dmalloc(100*sizeof(*p));
> int *r=3Drealloc(p, 120*sizeof(*r));
> if(!r)
> /* use the old p */
> /* use the new r and forget p address */
> I tried to make an example reasigning to a so big block that it couldn'=
t be
> succeeding (I did something like realloc(pointer,
> 15545454554545455454545454554545); but then windows closed the console,=
and
> I couldn't see the result.
> So, in the end, just what I feared at first, but couldn't prove the sec=
ond
> part with the experiment:
> numbers =3D (int*)realloc(numbers, newsize);
> is a practice better to avoid. Because if it fails then you get a block=
of
> memory which had been allocated , but not freed. so
>
> ------------------------------
>
> Then maybe this?
>
> char *ptr, *tmp_ptr;
> int buf_size =3D BUF_SIZE;
>
> *ptr =3D (char *)malloc(BUF_SIZE); // Assuming success
> *tmp_ptr =3D realloc(ptr, NEW_BUF_SIZE);
> if(tmp_ptr)
> {
> free(ptr);
> ptr =3D tmp_ptr;
> tmp_ptr =3D NULL;
> buf_size =3D NEW_BUF_SIZE;
> }
> ___________________________________________________________
>
> Abhijit Shylanath
>
> E-mail: mu...@gm... || ibr...@bi...
> Web-site: http://mudeth.tripod.com/
|
|
From: Carlos d. M. <cg...@wo...> - 2002-09-03 18:55:43
|
I don't see the point. unsigned char is one byte, isn't it? Maximum is 25= 5. So what sense has compare a variable which max value is 255 with a number greater? I remember reading somewhere that unsigned char is one byte in all comput= ers. Abhijit Shylanath escribi=F3: > > Hi List, > > > > > > > > I have an unsigned char* with the value 12345678 (as int) and I need = to > > compare the first 4 numbers with another value (unsigned char). > > > > Does someone have an idea ??? > > Greets, Christian. > > Is this what you're looking for? > > int foo =3D 12345678; > unsigned char bar =3D 23; > while(foo > 255) > foo /=3D 10; > if(foo =3D=3D bar) > // whatever > > ___________________________________________________________ > > Abhijit Shylanath > > E-mail: mu...@gm... || ibr...@bi... > Web-site: http://mudeth.tripod.com/ > > ------------------------------------------------------- > This sf.net email is sponsored by: OSDN - Tired of that same old > cell phone? Get a new here for FREE! > https://www.inphonic.com/r.asp?r=3Dsourceforge1&refcode1=3Dvs3390 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Ioannis V. <no...@ho...> - 2002-09-03 18:31:22
|
> -----Original Message-----
> From: Ioannis Vranos [mailto:no...@ho...]=20
> Sent: Tuesday, September 03, 2002 9:27 PM
> To: 'dev-cpp-users-list'
> Subject: RE: [Dev-C++] realloc
>=20
>=20
> > -----Original Message-----
> > From: dev...@li...=20
> > [mailto:dev...@li...] On Behalf=20
> > Of Abhijit Shylanath
> > Sent: Tuesday, September 03, 2002 7:58 PM
> > To: Carlos Garc=EDa del Monte; dev-cpp-users-list
> > Subject: Re: [Dev-C++] realloc
> >=20
> > Then maybe this?
> >=20
> > char *ptr, *tmp_ptr;
> > int buf_size =3D BUF_SIZE;
> >=20
> > *ptr =3D (char *)malloc(BUF_SIZE); // Assuming success
> > *tmp_ptr =3D realloc(ptr, NEW_BUF_SIZE);
> > if(tmp_ptr)
> > {
> > free(ptr);
>=20
>=20
> This is an error. If (tmp_ptr) means if realloc() succedeed.=20
> In this case ptr has already been freed.
For accuracy this is an error because of the following.
If realloc() succeeded:
a) It resized at the same place, then ptr is returned.
b) If local resizing was not feasible, it allocated a separate space,
copied the corresponding data and erased ptr.
In case a you erase the whole thing (tmp_ptr).
In case b you erased already freed space.
So in summary if the operation succeeds do not care for the old address.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ho...> - 2002-09-03 18:27:33
|
> -----Original Message-----
> From: dev...@li...=20
> [mailto:dev...@li...] On Behalf=20
> Of Abhijit Shylanath
> Sent: Tuesday, September 03, 2002 7:58 PM
> To: Carlos Garc=EDa del Monte; dev-cpp-users-list
> Subject: Re: [Dev-C++] realloc
>=20
> Then maybe this?
>=20
> char *ptr, *tmp_ptr;
> int buf_size =3D BUF_SIZE;
>=20
> *ptr =3D (char *)malloc(BUF_SIZE); // Assuming success
> *tmp_ptr =3D realloc(ptr, NEW_BUF_SIZE);
> if(tmp_ptr)
> {
> free(ptr);
This is an error. If (tmp_ptr) means if realloc() succedeed. In this
case ptr has already been freed.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ho...> - 2002-09-03 18:24:59
|
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Carlos
Garc=EDa del Monte
Sent: Tuesday, September 03, 2002 7:23 PM
To: dev-cpp-users-list
Subject: Re: [Dev-C++] realloc =20
I tried to make an example reasigning to a so big block that it couldn't
be succeeding (I did something like realloc(pointer,
15545454554545455454545454554545); but then windows closed the console,
and I couldn't see the result.=20
So, in the end, just what I feared at first, but couldn't prove the
second part with the experiment:=20
numbers =3D (int*)realloc(numbers, newsize); =20
=20
The casting is redundant (always speaking of C).
=20
=20
is a practice better to avoid. Because if it fails then you get a block
of memory which had been allocated , but not freed. =20
=20
For accuracy, if it fails you remain with the old allocated memory.
=20
so=20
if(!r){=20
[...]=20
free(p);=20
} =20
=20
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
<http://www.noicys.cjb.net/>=20
* Alternative URL: http://run.to/noicys
|