[Dev-C++] Re: Dev-cpp-users digest, Vol 1 #433 - 3 msgs
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Urmila S. <ums...@cc...> - 2001-09-26 22:03:13
|
Hi, My name is Urmila. I want to know if in C++ there is a built in function that will calculate the running time of an algorithm, and if so how do you use it? Urmila On Wed, 26 Sep 2001 dev...@li... wrote: > Send Dev-cpp-users mailing list submissions to > dev...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > or, via email, send a message with subject or body 'help' to > dev...@li... > > You can reach the person managing the list at > dev...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Dev-cpp-users digest..." > > > Today's Topics: > > 1. RE: C++ standard - Nesting classes. (Ioannis Vranos) > 2. RE: C++ standard - Nesting classes. (Ioannis Vranos) > 3. Building DLLs (Rodrigo Hjort) > > --__--__-- > > Message: 1 > From: "Ioannis Vranos" <no...@ya...> > To: <dev...@li...> > Subject: RE: [Dev-C++] C++ standard - Nesting classes. > Date: Wed, 26 Sep 2001 20:33:01 +0200 > Reply-To: dev...@li... > > Win32 API is old, MFC is old. .NET will have a different system call > class hierarchy called BCL (Base Class Library). So why learn legacy > stuff? > > For now, if you can't wait for .NET i suggest you Borland C++ Builder > and its class hierarchy called VCL (Visual Class Library). It is a lot > higher level than MFC/Win32 crap. For accuracy it is a very high level > Win32 wrapper. It covers anything and you will probably never need to > write win32 crap. Also, Borland RAD/VCL is more high level than the > RAD/BCL which will come with Visual Studio 7 and .NET in general. > Dev-C++ does not cover of course VCL, but i am telling you the best > solution for Windows programming (the best thing for you) for now. The > book "C++ Builder 5 Developer's Guide" by Sams Publishing comes with a > trial version of the Borland's IDE and this is also the book i suggest > you read for this particular IDE. > > As for "The C++ Programming Language" 3rd edition or special edition, > i suggest you read it all from cover to cover (although it will take > about 1-2 years). Reading for example 2-3 pages/day is a good speed, > with no much brain overhead and what you learn will not get wasted since > C++ will not change. :) > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.f2s.com > * Alternative URL: http://run.to/noicys > > > > -----Original Message----- > > From: dev...@li...=20 > > [mailto:dev...@li...] On Behalf=20 > > Of Jason Hardman > > Sent: Wednesday, September 26, 2001 5:29 PM > > To: dev...@li... > > Subject: Re: [Dev-C++] C++ standard - Nesting classes. > >=20 > >=20 > > Perhaps I should have been a little more clearer in the=20 > > wording I used. What am doing is declaring one class which is=20 > > the primary class that provides the functionality I am coding=20 > > (a glorified state storage object in this case), and that=20 > > class has other classes declared within it. These internal=20 > > class declerations are private and so it shoudn't be possible=20 > > to instantiate an object from one of these classes from=20 > > outside the object. The Example from Ioannis Vranos=20 > > (thanks)shows this quite well. > >=20 > > class A > > { > > public: > > enum errors{MEMORY, DISK, MONITOR}; > >=20 > > private: > > class E > > { > > errors e; > >=20 > > public: > > E(errors er):e(er) {} > > }; > >=20 > > }; > >=20 > > int main() > > { > > A a; > >=20 > > A::errors e; > >=20 > > A::E x(e); // Mistake, E is private > > } > >=20 > > This compiles under Dev - C++ with MinGW, but not with=20 > > Borland C++ 5.5. > >=20 > > Declaring a class doesn't create an instance of it, but AFAIK=20 > > it should still be subject to the access specifier it was=20 > > declared under. This is probably a known issue for MinGW,=20 > > although I haven't had a chance to check that yet. > >=20 > > By the way, I already have Bjarn Stroustrup's book. I already=20 > > knew how to code in C++ before getting it so never really=20 > > read it all the way through, but I use it whenever I want=20 > > know about the best approach to a design. It has a lot of=20 > > useful information although there are easier books to use as=20 > > a reference. > >=20 > > I have very little experience of Windows programming myself,=20 > > but that something else I am trying to learn at this point.=20 > > Any suggestions by anyone as to a good Windows API book would=20 > > be appreciated by the way. Whenever I find a Windows book it=20 > > is primarily about using MFC to write windows programs, but I=20 > > don't have access to MFC at the moment so it's pretty useless to me. > >=20 > > Thanks all, Jason. > >=20 > > PS: sorry about blathering on and on, I do that alot. :-D > >=20 > > ----- Original Message ----- > > From: "Michael Codadeen" <jd...@ho...> > > To: <dev...@li...> > > Sent: Wednesday, September 26, 2001 8:39 AM > > Subject: Re: [Dev-C++] C++ standard - Nesting classes. > >=20 > >=20 > > > Hi Jason, > > > > > > The standard states that anything in your private area is only=20 > > > accessable > > by > > > that class. Not even public derived classes of that class=20 > > can access=20 > > > it. > > > > > > The protected area is accessable by public derived classes of that=20 > > > class. > > In > > > effect it becomes the private area of that derived class. Also,=20 > > > classes of the same type that get passed into an object as=20 > > an argument=20 > > > may have their protected area accessed. > > > > > > i.e. > > > > > > Class A { > > > public: > > > inline mthd(Class A& obj){cout << obj.data << endl;}; > > > protected: > > > data; > > > } > > > > > > Class A a, b; > > > a.mthd(b); << object a can access b protected area. > > > > > > The public area of a class can be accessed by anyone. > > > > > > The story is slightly different for protected and private derived=20 > > > classes. For more info get Stroustrups book. > > > > > > http://www.research.att.com/~bs/ > > > > > > I would not usually have a class called main, I would=20 > > normally have a > > public > > > static main() function and tell my compiler which class contains=20 > > > main(). However, I guess this changes when you are Windows=20 > > programming=20 > > > of which I have no experience. > > > > > > Could you send an example of what you are doing so we could=20 > > help some > > more. > > > > > > Thanks, > > > > > > Michael > > > > > > >From: "Jason Hardman" <jas...@bt...> > > > >Reply-To: dev...@li... > > > >To: "Dev-C++" <dev...@li...> > > > >Subject: [Dev-C++] C++ standard - Nesting classes. > > > >Date: Wed, 26 Sep 2001 03:03:24 +0100 > > > > > > > >Hi, > > > > > > > >In a project I have been working on I have nested some=20 > > classes within=20 > > > >a main class that provides an overall functionality. I=20 > > wanted to make=20 > > > >these internal classes inaccessible to anyone using the=20 > > main class. I=20 > > > >had hoped that putting them in a private or protected area of the=20 > > > >main class it > > would > > > >stop outside access, but this doesn't seem to work in Dev-C++=20 > > > >(MinGW). > > Does > > > >anyone know if that is standard C++ behaviour? None of my=20 > > C++ books=20 > > > >say anything about access specifiers and nested classes,=20 > > and they say=20 > > > >pretty little about nested classes full-stop. It could=20 > > reasonally be=20 > > > >that only data and methods are affected by access specifiers, but=20 > > > >it's hard for me to be sure. > > > > > > > >I am now looking for an alternative way of hiding those classes,=20 > > > >although > > I > > > >have found some interesting options in using an implementation=20 > > > >namespace, > > I > > > >am still interesting in hearing any other ideas? > > > > > > > >Thanx, Jason. > > > > > > > > > > > >_______________________________________________ > > > >Dev-cpp-users mailing list Dev...@li... > > > >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > > > > _________________________________________________________________ > > > Get your FREE download of MSN Explorer at=20 > > > http://explorer.msn.com/intl.asp > > > > > > > > > _______________________________________________ > > > Dev-cpp-users mailing list Dev...@li... > > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > >=20 > >=20 > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > >=20 > > > > --__--__-- > > Message: 2 > From: "Ioannis Vranos" <no...@ya...> > To: <dev...@li...> > Subject: RE: [Dev-C++] C++ standard - Nesting classes. > Date: Wed, 26 Sep 2001 20:34:30 +0200 > Reply-To: dev...@li... > > Stroustrup has a link at his pages for a pdf of a very recent draft for > the standard. > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.f2s.com > * Alternative URL: http://run.to/noicys > > > > -----Original Message----- > > From: dev...@li...=20 > > [mailto:dev...@li...] On Behalf=20 > > Of Jason Hardman > > Sent: Wednesday, September 26, 2001 4:56 PM > > To: dev...@li... > > Subject: Re: [Dev-C++] C++ standard - Nesting classes. > >=20 > >=20 > > Thanks for that. I don't currently have any other compilers=20 > > on my system so hadn't thought to check. I know that the=20 > > Borland Compiler is probably the most standard compliant=20 > > compiler available, so the fact that it didn't work on it=20 > > probably meens it is standard. > >=20 > > I guess I'll have to inquire of the MinGW development=20 > > community to see about them adding compliance. Thinking of=20 > > all this I remember hearing about a website that contains a=20 > > copy of the C++ standard, does anyone know where it it? I=20 > > will be searching for it, but it would be easier if somebody=20 > > already knows about it. > >=20 > > Thanks, Jason. > >=20 > > ----- Original Message ----- > > From: "Ioannis Vranos" <no...@ya...> > > To: <dev...@li...> > > Sent: Wednesday, September 26, 2001 1:11 PM > > Subject: RE: [Dev-C++] C++ standard - Nesting classes. > >=20 > >=20 > > You are right. The following code compiles in Dev-C++: > >=20 > > class A > > { > > public: > > enum errors{ MEMORY, DISK, MONITOR}; > >=20 > > private: > > class E > > { > > errors e; > >=20 > > public: > > E(errors er):e(er) {} > > }; > >=20 > > }; > >=20 > > int main() > > { > > A a; > >=20 > > A::errors e; > >=20 > > A::E x(e); // Mistake, E is private > > } > >=20 > >=20 > > This shouldn't compile, so i consider it a compiler defect.=20 > > Borland C++ 5.5 gives the (expected) error: > >=20 > > Error E2247 temp.cpp 23: 'A::E' is not accessible in function main() > > *** 1 errors in Compile *** > >=20 > >=20 > > Ioannis > >=20 > > * Ioannis Vranos > > * Programming pages: http://www.noicys.f2s.com > > * Alternative URL: http://run.to/noicys > >=20 > >=20 > >=20 > > > -----Original Message----- > > > From: dev...@li... > > > [mailto:dev...@li...] On=20 > > Behalf Of Jason=20 > > > Hardman > > > Sent: Wednesday, September 26, 2001 4:03 AM > > > To: Dev-C++ > > > Subject: [Dev-C++] C++ standard - Nesting classes. > > > > > > > > > Hi, > > > > > > In a project I have been working on I have nested some=20 > > classes within=20 > > > a main class that provides an overall functionality. I=20 > > wanted to make=20 > > > these internal classes inaccessible to anyone using the=20 > > main class. I=20 > > > had hoped that putting them in a private or protected area=20 > > of the main=20 > > > class it would stop outside access, but this doesn't seem to work > > > in Dev-C++ (MinGW). Does anyone know if that is standard C++ > > > behaviour? None of my C++ books say anything about access > > > specifiers and nested classes, and they say pretty little > > > about nested classes full-stop. It could reasonally be that > > > only data and methods are affected by access specifiers, but > > > it's hard for me to be sure. > > > > > > I am now looking for an alternative way of hiding those classes,=20 > > > although I have found some interesting options in using an=20 > > > implementation namespace, I am still interesting in hearing=20 > > any other=20 > > > ideas? > > > > > > Thanx, Jason. > > > > > > > > > _______________________________________________ > > > Dev-cpp-users mailing list Dev...@li... > > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > >=20 > >=20 > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > >=20 > >=20 > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > >=20 > > > > --__--__-- > > Message: 3 > From: "Rodrigo Hjort" <rod...@ac...> > To: "Dev-C++ Users List" <dev...@li...> > Date: Wed, 26 Sep 2001 15:11:08 -0300 > Subject: [Dev-C++] Building DLLs > Reply-To: dev...@li... > > This is a multi-part message in MIME format. > > ------=_NextPart_000_0070_01C1469D.78339220 > Content-Type: text/plain; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > Dear Dev-C++ users, > > I'm trying to build a DLL to use with other applications made in Delphi = > and VB. > The code below is a very simple DLL I tried to make using Dev-C++. > > It compiles perfectly and creates the DLL file. > But appears the warning: "no export definition file provided; dllwrap = > will create one, but may not be what you want". > I noticed that it uses the file "dll.def" and modifies the name of the = > function in the DLL to "TimesTwo__Fi". > > I created a .DEF file, which is below, that I wanted the linker to use. = > How could be this possible? > Does anyone have a simple DLL made with Dev-C++, in C language? > > Thanks in advance, > > Rodrigo Hjort > rod...@ac... > > > **** C source code ***** > #include <windows.h> > > int WINAPI _export TimesTwo(int x); > /* int extern TimesTwo(int x); */ /*also tried this*/ > > BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL,=20 > DWORD fdwReason, LPVOID lpvReserved) > { > switch (fdwReason) > { > case DLL_PROCESS_ATTACH: break; > case DLL_THREAD_ATTACH: break; > case DLL_PROCESS_DETACH: break; > case DLL_THREAD_DETACH: break; > } > return TRUE; > } > > int WINAPI _export TimesTwo(int x) > /*int extern TimesTwo(int x)*/ > { > return x * 2; > } > ************************* > > > *** DEF file ****** > LIBRARY Sample > DESCRIPTION 'SAMPLE DLL' > CODE PRELOAD MOVABLE DISCARDABLE > DATA PRELOAD SINGLE > EXPORTS > TimesTwo > ******************* > > ------=_NextPart_000_0070_01C1469D.78339220 > Content-Type: text/html; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> > <HTML><HEAD> > <META content=3D"text/html; charset=3Diso-8859-1" = > http-equiv=3DContent-Type> > <META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR> > <STYLE></STYLE> > </HEAD> > <BODY bgColor=3D#ffffff> > <DIV><FONT face=3D"Courier New" size=3D2> > <DIV>Dear Dev-C++ users,</DIV> > <DIV> </DIV> > <DIV>I'm trying to build a DLL to use with other applications made in = > Delphi and=20 > VB.</DIV> > <DIV>The code below is a very simple DLL I tried to make using = > Dev-C++.</DIV> > <DIV> </DIV> > <DIV>It compiles perfectly and creates the DLL file.</DIV> > <DIV>But appears the warning: "no export definition file provided; = > dllwrap will=20 > create one, but may not be what you want".</DIV> > <DIV>I noticed that it uses the file "dll.def" and modifies the name of = > the=20 > function in the DLL to "TimesTwo__Fi".</DIV> > <DIV> </DIV> > <DIV>I created a .DEF file, which is below, that I wanted the linker to = > use. How=20 > could be this possible?</DIV> > <DIV>Does anyone have a simple DLL made with Dev-C++, in C = > language?</DIV> > <DIV> </DIV> > <DIV>Thanks in advance,</DIV> > <DIV> </DIV> > <DIV><FONT face=3D"Courier New" size=3D2>Rodrigo Hjort<BR><A=20 > href=3D"mailto:rod...@ac...">rod...@ac...= > m.br</A></FONT></DIV> > <DIV> </DIV></FONT></DIV> > <DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV> > <DIV><FONT face=3D"Courier New" size=3D2>**** C source code = > *****<BR>#include=20 > <windows.h></FONT></DIV> > <DIV> </DIV> > <DIV><FONT face=3D"Courier New" size=3D2>int WINAPI _export TimesTwo(int = > x);<BR>/*=20 > int extern TimesTwo(int x); */ /*also tried this*/</FONT></DIV> > <DIV> </DIV> > <DIV><FONT face=3D"Courier New" size=3D2>BOOL WINAPI = > DllEntryPoint(HINSTANCE=20 > hinstDLL, </FONT></DIV> > <DIV><FONT face=3D"Courier New" size=3D2> DWORD = > fdwReason, LPVOID=20 > lpvReserved)<BR>{<BR> switch = > (fdwReason)<BR> =20 > {<BR> case DLL_PROCESS_ATTACH:=20 > break;<BR> case DLL_THREAD_ATTACH:=20 > break;<BR> case DLL_PROCESS_DETACH: = > > break;<BR> case DLL_THREAD_DETACH:=20 > break;<BR> }<BR> return=20 > TRUE;<BR>}</FONT></DIV> > <DIV> </DIV> > <DIV><FONT face=3D"Courier New" size=3D2>int WINAPI _export TimesTwo(int = > x)<BR>/*int=20 > extern TimesTwo(int x)*/</FONT></DIV> > <DIV><FONT face=3D"Courier New" size=3D2>{<BR> return = > x *=20 > 2;<BR>}<BR>*************************</FONT></DIV> > <DIV> </DIV> > <DIV><FONT face=3D"Courier New" size=3D2><BR>*** DEF file=20 > ******<BR>LIBRARY =20 > Sample<BR>DESCRIPTION 'SAMPLE=20 > DLL'<BR>CODE = > PRELOAD=20 > MOVABLE=20 > DISCARDABLE<BR>DATA = > =20 > PRELOAD=20 > SINGLE<BR>EXPORTS<BR> &nbs= > p; =20 > TimesTwo<BR>*******************</FONT></DIV></BODY></HTML> > > ------=_NextPart_000_0070_01C1469D.78339220-- > > > > > --__--__-- > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > End of Dev-cpp-users Digest > |