dev-cpp-users Mailing List for Dev-C++ (Page 438)
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: Ioannis V. <no...@ho...> - 2003-02-18 09:12:55
|
-------Original Message-------=0D =0D From: Jaap de Wolff=0D Date: =D4=F1=DF=F4=E7, 18 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 11:07:46= =F0=EC=0D To: Dev-C++ Mailing List=0D Subject: adress of member function (was RE: [Dev-C++] differnece between system pause and cin.get())=0D =0D =0D =0D =3D=3D> No, no, no. Try assigning a member function to a pointer for a re= gular=0D function. Try to print the "address" of a member function. The standard d= oes=0D not restrict how member functions are implemented, only that they cannot = be=0D expected to be regular functions. Usually, member functions are called=0D through an offset of an array.=0D =0D =3D=3D=3D=3D=3D> Yes, you can assign a member function to a member functi= on pointer=0D The following program demonstrates it:=0D =0D =3D> Only that i said we cannot assign the "address" of a member function= to a regular (non-member) function pointer.=0D =0D =3D> So basically i agree with what you said.=0D =0D =0D Ioannis Vranos=0D =0D * Programming pages: http://www.noicys.freeurl.com=0D * Alternative URL: http://run.to/noicys=20 |
|
From: Ioannis V. <no...@ho...> - 2003-02-18 09:08:06
|
Let's clear this one for all. What the standard says:=0D =0D "A pointer to member shall not point to a static member of a class (9.4),= a member with reference type, or =93cv void.=94 [Note: see also 5.3 and 5.5= =2E The type =93pointer to member=94 is distinct from the type =93pointer=94, tha= t is, a pointer to member is declared only by the pointer to member declarator syntax, and never by the pointer declarator syntax. There is no =93refere= nce to member=94 type in C++. ]"=0D =0D "A pointer to member is only formed when an explicit & is used and its operand is a qualified id not enclosed in parentheses. [Note: that is, th= e expression &(qualifiedid),=0D where the qualified id is enclosed in parentheses, does not form an expression of type =93pointer to member.=94 Neither does qualified id, be= cause there is no implicit conversion from a qualified id for a nonstatic membe= r function to the type =93pointer to member function=94 as there is from an= lvalue of function type to the type =93pointer to function=94 (4.3). Nor is & unqualified id a pointer to member, even within the scope of the unqualif= ied id=92s class. ]"=0D =0D =0D In summary pointers to member functions are not equivalent to pointers to regular functions. They can be (and usually are) implemented differently.= =0D =0D =0D Ioannis Vranos=0D =0D * Programming pages: http://www.noicys.freeurl.com=0D * Alternative URL: http://run.to/noicys=20 |
|
From: Jaap de W. <wo...@Ne...> - 2003-02-18 09:06:00
|
-----Original Message-----
From: Ioannis Vranos [mailto:no...@ho...]
Sent: Tuesday, February 18, 2003 09:23 AM
To: Dev-C++ Mailing List
Cc: Dev-C++ Mailing List
Subject: Re: [Dev-C++] differnece between system pause and cin.get()
-------Original Message-------
From: Per Westermark
Date: =D4=F1=DF=F4=E7, 18 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 =
9:42:16 =F0=EC
To: Ioannis Vranos
Cc: Dev-C++ Mailing List
Subject: Re: [Dev-C++] differnece between system pause and cin.get()
...
Member functions always have a regular address. Your description of =
call
through an offset in an array is the special case of a call to a =
virtual
method.
=3D=3D> No, no, no. Try assigning a member function to a pointer for a =
regular
function. Try to print the "address" of a member function. The standard =
does
not restrict how member functions are implemented, only that they =
cannot be
expected to be regular functions. Usually, member functions are called
through an offset of an array.
=3D=3D=3D=3D=3D> Yes, you can assign a member function to a member =
function pointer
The following program demonstrates it:
#include "stdio.h"
class Demo;
typedef bool (Demo::*CommandCallback)(const char *);
class Demo
{
public:
bool aMemberFunction(const char *);
CommandCallback GiveCallback();
};
bool Demo::aMemberFunction(const char *arg)
{
printf ("This is printed in a member funtion %s\n", arg);
return true;
}
CommandCallback Demo::GiveCallback()
{
return &Demo::aMemberFunction;
}
main()
{
Demo test;
CommandCallback Fn =3D test.GiveCallback();
(test.*Fn)("So it works");
}
Jaap de Wolff
|
|
From: Jaap de W. <wo...@Ne...> - 2003-02-18 08:36:56
|
at this moment there is no std::string<wchar_t> support in the Mingw compiler. This is a known problem, it has to do with missing functions in MSVCRT.DLL. Jaap > -----Original Message----- > From: Torsten Curdt [mailto:tc...@df...] > Sent: Monday, February 17, 2003 03:41 PM > To: dev...@li... > Subject: [Dev-C++] unicode > > > I just switched my application to unicode by specifying the > "-D UNICODE" and "-D _UNICODE" compiler options. > > But the STL string class refused to accept that. Though > it uses the "charT" type. > > Any pointers how to switch it to unicode? > -- > Torsten > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > 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...> - 2003-02-18 08:23:25
|
-------Original Message-------=0D
=0D
From: Per Westermark=0D
Date: =D4=F1=DF=F4=E7, 18 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 9:42:16 =
=F0=EC=0D
To: Ioannis Vranos=0D
Cc: Dev-C++ Mailing List=0D
Subject: Re: [Dev-C++] differnece between system pause and cin.get()=0D
=0D
For register calling convention, the this pointer may be sent for free=0D
from one member of the class to another member of the class, since the=0D
register will already be initialized with this. For stack calling=0D
convention, it HAS to take extra time, since it's an extra 32-bit put pus=
h=0D
on the stack. Also, weith register calling, the first call HAVE to take=0D
extra time, since the compiler must load the address of the object before=
=0D
making the call.=0D
=0D
=0D
=3D=3D> Ok, so in few words you are telling that the regular function cal=
ls have
an additional extra cost because of the stack calling convention, while
member functions have that time cost only at the first call when it fetch=
es
it from memory to register. So we agree.=0D
=0D
=0D
=0D
Member functions always have a regular address. Your description of call=0D
through an offset in an array is the special case of a call to a virtual=0D
method.=0D
=0D
=0D
=3D=3D> No, no, no. Try assigning a member function to a pointer for a re=
gular
function. Try to print the "address" of a member function. The standard d=
oes
not restrict how member functions are implemented, only that they cannot =
be
expected to be regular functions. Usually, member functions are called
through an offset of an array.=0D
=0D
=0D
However, the constructor for the same class may still call=0D
directly without going to the VMT (Virtual Method Table). A call through=0D
the VMT is slower, since the compiler first have to load the VMT table=0D
address as an offset from the this pointer, and then do the call from an=0D
offset into the table.=0D
=0D
If you don't believe me, just ask the compiler to emit assembler output=0D
and have a peek.=0D
=0D
=0D
=3D=3D> You are out of range for me. :) I do not know assembly almost at =
all and
i am telling only what i have read/learned. But since we know C++ we can =
do
the test:=0D
=0D
#include <iostream>=0D
#include <ctime>=0D
#include <limits>=0D
#include <cstdio>=0D
=0D
class something=0D
{=0D
unsigned long x;=0D
=0D
public:=0D
something(int y=3D0):x(y) {}=0D
=0D
void test();=0D
friend void testf(something &);=0D
};=0D
=0D
=0D
=0D
int main()=0D
{=0D
using namespace std;=0D
=0D
clock_t t1, t2, t3, t4, temp;=0D
=0D
unsigned long i;=0D
=0D
something blade;=0D
=0D
cout<<"Number of iterations for each kind: "<<numeric_limits<unsigned
long>::max()/20<<endl;=0D
=0D
=0D
for (t1=3Dtemp=3Dclock(); !(t1-temp); t1=3Dclock())=0D
;=0D
=0D
=0D
for(i=3D0; i<numeric_limits<unsigned long>::max()/20; i++)=0D
blade.test();=0D
=0D
t2=3Dclock();=0D
=0D
cout<<"Time consumed by "<<numeric_limits<unsigned long>::max()/20<<" ca=
lls
of void something::test(): ";=0D
cout<<static_cast<double>(t2-t1)/CLOCKS_PER_SEC<<endl;=0D
=0D
=0D
for (t3=3Dtemp=3Dclock(); !(t3-temp); t3=3Dclock())=0D
;=0D
=0D
for(i=3D0; i<numeric_limits<unsigned long>::max()/20; i++)=0D
testf(blade);=0D
=0D
t4=3Dclock();=0D
=0D
cout<<"Time consumed by "<<numeric_limits<unsigned long>::max()/20<<" ca=
lls
of void testf(something &): ";=0D
cout<<static_cast<double>(t4-t3)/CLOCKS_PER_SEC<<endl;=0D
=0D
}=0D
=0D
=0D
void testf(something &x) { x.x++; }=0D
=0D
void something::test() { x++; }=0D
=0D
=0D
=3D=3D> This code in my system produces:=0D
=0D
C:\c>temp=0D
Number of iterations for each kind: 214748364=0D
Time consumed by 214748364 calls of void something::test(): 0.45=0D
Time consumed by 214748364 calls of void testf(something &): 0.461=0D
=0D
=0D
The difference is very slight, negligible. However after repeative runs,
testf() consistently remains the slower:=0D
=0D
C:\c>temp=0D
Number of iterations for each kind: 214748364=0D
Time consumed by 214748364 calls of void something::test(): 0.45=0D
Time consumed by 214748364 calls of void testf(something &): 0.461=0D
=0D
C:\c>temp=0D
Number of iterations for each kind: 214748364=0D
Time consumed by 214748364 calls of void something::test(): 0.45=0D
Time consumed by 214748364 calls of void testf(something &): 0.481=0D
=0D
C:\c>temp=0D
Number of iterations for each kind: 214748364=0D
Time consumed by 214748364 calls of void something::test(): 0.45=0D
Time consumed by 214748364 calls of void testf(something &): 0.481=0D
=0D
C:\c>temp=0D
Number of iterations for each kind: 214748364=0D
Time consumed by 214748364 calls of void something::test(): 0.45=0D
Time consumed by 214748364 calls of void testf(something &): 0.481=0D
=0D
=0D
=0D
=0D
Bottom line: As I said on my original mail, member calls are slower than=0D
regular calls, but these extra nanoseconds might be ignored for just abou=
t=0D
all programs out there, since the majority of the runtime is in other=0D
parts of the program.=0D
=0D
=0D
=3D=3D> I disagree, but that's life.=0D
=0D
=0D
=0D
Ioannis Vranos=0D
=0D
* Programming pages: http://www.noicys.freeurl.com=0D
* Alternative URL: http://run.to/noicys=20 |
|
From: Per W. <pw...@ia...> - 2003-02-18 07:43:27
|
On Tue, 18 Feb 2003, Ioannis Vranos wrote:
> -------Original Message-------
>
> From: Per Westermark
> Date: =D4=F1=DF=F4=E7, 18 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 2:16:24 =
=F0=EC
> To: Ioannis Vranos
> Cc: dev...@li...
> Subject: Re: [Dev-C++] differnece between system pause and cin.get()
>
> > =3D=3D> It depends on how many things are written inside get(). However=
the
> > member function call is usually faster than a regular function call. Bu=
t i
> > do not think you should be so space/time concerned. :)
>
> For just about any type of programming, you may ignore any speed
> difference between member call and regular function call. For a new
> normal PC, we are talking nano-seconds. A member function call is normall=
y
> just a teeny bit slower, since it is a regular call with the extra
> requirement that it must send a 'this' pointer in registers or on the
> stack. If the member function is virtual, the member call must also
> perform the call indirect, by locating the call address in the VMT
> for the object. The only time a member call is as fast as a regular
> function call is if the member function is declared static - but then it
> is a regular function declared in the namespace of the class.
>
> -------------------------------------------------------------------------=
----
> ------------
> =3D=3D> We are getting lost in the details here, but for non-virtual memb=
er
> functions passing *this does not imply any additional time cost in
> comparison to regular functions. Also i do not think passing *this to
> anything is required. Member functions do not have a regular address. The=
y
> are usually called as an offset in an array. It is something like
For register calling convention, the this pointer may be sent for free
from one member of the class to another member of the class, since the
register will already be initialized with this. For stack calling
convention, it HAS to take extra time, since it's an extra 32-bit put push
on the stack. Also, weith register calling, the first call HAVE to take
extra time, since the compiler must load the address of the object before
making the call.
The only time the compiler can avoid passing the this ptr at a method
call, is if the destination method is non-virtual and the compiler
generates the code inline. Even if it knows that a specific method never
touches any part of the object, the compiler may only ignore the this ptr
if it knows that ALL uses of the method will always use same calling
convention. If some modules just sees the declaration of the method wile
compile modules may see the full implementation, the compiler must be
consequent and assume that the method needs the this ptr. Static-declared
methods are the only way to inform the compiler that a method does not
have a this ptr. But then a static method is a regular function declared
in the namespace of the class.
Member functions always have a regular address. Your description of call
through an offset in an array is the special case of a call to a virtual
method. However, the constructor for the same class may still call
directly without going to the VMT (Virtual Method Table). A call through
the VMT is slower, since the compiler first have to load the VMT table
address as an offset from the this pointer, and then do the call from an
offset into the table.
If you don't believe me, just ask the compiler to emit assembler output
and have a peek.
>
> array[4](whatever)
>
>
> A regular friend function call for example would be implemented as someth=
ing
> like:
>
> something(this, whatever). It's tough to say which is faster. So lets
> consider them as of equal time cost and be in peace. :P
>
> However statistically speaking member functions tend to be small and inli=
ned
> while regular functions manipulating objects not. But this can be disput=
ed
> too. As i said, this shouldn't be taken under any consideration, that is =
the
> time cost difference between cin.get() and system("pause"). Although syst=
em
> has a function call time cost+a program invocation time cost+command.com/=
cmd
> exe invocation time cost.
> -------------------------------------------------------------------------=
----
> ----------------
The information that may be seen from a couple of analyzes of different
compilers - several peopple have done it is:
A cpp+ compiler normally generantes more efficient code for a member call
with implicit this pointer, than the corresponding C code with an explicit
THIS ptr, i.e.
obj->hello(a,b,c);
is normally faster than
hello(&obj,a,b,c);
and a C++ call to a virtual method normally generates better code than a C
call through a pointer access, i.e.
obj->my_virtual_call(a,b,c);
is normally faster than
obj->vmt[3]->my_virtual_call(&obj,a,b,c);
But this is just that since a C++ compiler have somany this references and
VMT-indirect calls, the compiler writers have made sure that these cases
should generate good code, my making sure that the this ptr have a high
priority while assigning register variables etc. It still doesn't change
the fact that for stack parameter passing, the this ptr is extra work, and
a virtual method is always extra work compared to a non-virtual method or
compared to a regular function call.
Bottom line: As I said on my original mail, member calls are slower than
regular calls, but these extra nanoseconds might be ignored for just about
all programs out there, since the majority of the runtime is in other
parts of the program.
>
>
>
> What is important in this case is that system() is special. It is a
> request to start a new program 'PAUSE' and wait for that program to end,
> i.e. wait until you press a character.
>
> This is not the slightest problem for testing a debug-version of a
> program. However, in real production code, some care should be taken abou=
t
> the use of system() calls, because of the very large amount of work the o=
s
> has to do to perform the call. One call to system() might sound nice, but
> probably represents 100-10000 calls or more depending on what type of
> command that are put as argument. The OS has to start a new proces, with
> new stack... and might in some cases consume more memory and/or cpu
> time for the system() call than for the rest of the application.
>
> =3D=3D> Yes.
>
>
> Ioannis Vranos
>
> * Programming pages: http://www.noicys.freeurl.com
> * Alternative URL: http://run.to/noicys
|
|
From: Johannes P. <joh...@pr...> - 2003-02-18 04:33:49
|
Good day
-=0=0-=00--0
I have a C/asm related question that is puzzling me. If possible can
somebody please give some input on it as I don't really have a clue
on where to go from here.
in the example below I add the SEGment of the handler function to the AX
register.
//======================= SNIP START ===========================
void handler(void){
return;
}
void main(void){
asm{
mov ax,SEG handler
}
}
//==========8<============ SNIP END ===========================
with the dos.h and stdio.h this compiles with no problems at all.
But when changing this to a class as seen below.
//========================= SNIP START ========================
class te{
private:
int vga;
protected:
void handler_te(void);
public:
void init(void);
};
void te::handler_te(void){
return 0;
}
void te::init(void){
asm{
mov ax,SEG this.handler_te
}
}
//============= 8< ========== SNIP END ===========================
when compiling this with the same headers you get the following error.
Error SEGTEST.CPP 19: Undefined symbol 'handler_te'
This is confusing me as I don't know how to get around this.
Any input will be appreciated.
Thanks in Advance
Johannes Pretorius
|
|
From: <ru...@wp...> - 2003-02-18 04:17:45
|
Sometimes when I make modifications to files in project, the class browser randomly moves some or all class nodes out of folders to the top level. Szczepan Hołyszewski |
|
From: Ioannis V. <no...@ho...> - 2003-02-18 02:18:42
|
-------Original Message-------=0D
=0D
From: Per Westermark=0D
Date: =D4=F1=DF=F4=E7, 18 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 2:16:24 =
=F0=EC=0D
To: Ioannis Vranos=0D
Cc: dev...@li...=0D
Subject: Re: [Dev-C++] differnece between system pause and cin.get()=0D
=0D
> =3D=3D> It depends on how many things are written inside get(). However=
the=0D
> member function call is usually faster than a regular function call. Bu=
t i=0D
> do not think you should be so space/time concerned. :)=0D
=0D
For just about any type of programming, you may ignore any speed=0D
difference between member call and regular function call. For a new=0D
normal PC, we are talking nano-seconds. A member function call is normall=
y=0D
just a teeny bit slower, since it is a regular call with the extra=0D
requirement that it must send a 'this' pointer in registers or on the=0D
stack. If the member function is virtual, the member call must also=0D
perform the call indirect, by locating the call address in the VMT=0D
for the object. The only time a member call is as fast as a regular=0D
function call is if the member function is declared static - but then it=0D
is a regular function declared in the namespace of the class.=0D
=0D
-------------------------------------------------------------------------=
----
------------=0D
=3D=3D> We are getting lost in the details here, but for non-virtual memb=
er
functions passing *this does not imply any additional time cost in
comparison to regular functions. Also i do not think passing *this to
anything is required. Member functions do not have a regular address. The=
y
are usually called as an offset in an array. It is something like=0D
=0D
array[4](whatever)=0D
=0D
=0D
A regular friend function call for example would be implemented as someth=
ing
like:=0D
=0D
something(this, whatever). It's tough to say which is faster. So lets
consider them as of equal time cost and be in peace. :P=0D
=0D
However statistically speaking member functions tend to be small and inli=
ned
while regular functions manipulating objects not. But this can be disput=
ed
too. As i said, this shouldn't be taken under any consideration, that is =
the
time cost difference between cin.get() and system("pause"). Although syst=
em
has a function call time cost+a program invocation time cost+command.com/=
cmd
exe invocation time cost.=0D
-------------------------------------------------------------------------=
----
----------------=0D
=0D
=0D
=0D
What is important in this case is that system() is special. It is a=0D
request to start a new program 'PAUSE' and wait for that program to end,=0D
i.e. wait until you press a character.=0D
=0D
This is not the slightest problem for testing a debug-version of a=0D
program. However, in real production code, some care should be taken abou=
t=0D
the use of system() calls, because of the very large amount of work the o=
s=0D
has to do to perform the call. One call to system() might sound nice, but=
=0D
probably represents 100-10000 calls or more depending on what type of=0D
command that are put as argument. The OS has to start a new proces, with=0D
new stack... and might in some cases consume more memory and/or cpu=0D
time for the system() call than for the rest of the application.=0D
=0D
=3D=3D> Yes.=0D
=0D
=0D
Ioannis Vranos=0D
=0D
* Programming pages: http://www.noicys.freeurl.com=0D
* Alternative URL: http://run.to/noicys=20 |
|
From: Ioannis V. <no...@ho...> - 2003-02-18 02:00:52
|
-------Original Message-------=0D =0D From: Catsquotl=0D Date: =D4=F1=DF=F4=E7, 18 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 1:22:44 = =F0=EC=0D To: dev...@li...=0D Subject: Re: [Dev-C++] differnece between system pause and cin.get()=0D =0D Thanks for the response.=0D Is there a way of chekking if there`s annything left in the cin stream. =0D Or to empty it for that matter before using it as a tool for keeping dos boxes open :-)=0D =0D =0D =3D=3D> You can ensure it is empty by applying cin.ignore() after any cin= you perform. There are other ways too.=0D =0D =0D Ioannis Vranos=0D =0D * Programming pages: http://www.noicys.freeurl.com=0D * Alternative URL: http://run.to/noicys=20 |
|
From: Lucas K. T. <lk...@bo...> - 2003-02-18 01:01:21
|
Although this is probably pretty useless to you... =20 >Thanks for the response. >Is there a way of chekking if there`s annything left in the >cin = stream.=20 >Or to empty it for that matter before using it as a tool for >keeping = dos boxes open :-) Well to empty the keyboard buffer, you'd have to go through memory = access and move the value that is within: 40h:[1Ch] to 40h:[1Ah], 'cause = you see, the keyb buffer is circular and 32-bytes long, and 40h:[1Ah] = points to it's head, while 40h:[1Ch] points to it's tail, so basically, = by assigning the same value to them, the buffer would get cleared, = sample code (although I'm not sure this would work in a Win console = program, it'd work on a DOS program): word tail; tail =3D peek(0x40, 0x1C); poke(0x40, 0x1A, tail); Or perhaps you could try: poke(0x40, 0x1A, peek(0x40, 0x1C)); directly... I'm have tested neithe,r but they should work just fine... Unecessary information, thoguh... but it's always nice ot learn new = things... hehee =3D) lkt153 |
|
From: Lucas K. T. <lk...@bo...> - 2003-02-18 00:52:34
|
Bom saber que tem outro brasileiro por aqui.... n=E3o sou bom com wxWindows, mas poderia tentar ajudar... heh ali=E1s, so= u de Sampa... lkt153 > > > hi all, > > i have just downloaded and installed Dev-C++ 5.0 beta 7 (4.9.7.0) wit= h > > Mingw/GCC 2.95.3 on Win 98 system. > > > > Everything is working ok, except when I try to use wxWindows, that I > > got from devpack "WxWindows-2.2.9.DevPak". It compiles a simple > > program generated directly from wxWndows template, but it results in = a > > lot of linker errors (undefined references). > > > > What am I missing? > > Could you send me the errors ? > > > > > TIA > > > > Nilo R C Paim > > np...@ho... > > Porto Alegre - RS - Brasil > > > > > > _________________________________________________________________ > > Protect your PC - get McAfee.com VirusScan Online > > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3D3963 > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > 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: Ali M. <am...@ur...> - 2003-02-18 00:27:07
|
Hi again
I little explaining on my problem:
I want to make a small packet filtering program runing under WinME. I've
worked a few times before with C sockets. My main problem is that I want to
be able to grab all the incoming packets before the apps that they are
intended to, and to be able to either let them go, or block them from
reaching there based on the IP they came from. I know how to get the IP, but
don't know how the filtering program will be able to intercept the incoming
traffic.
Any help is really appretiated.
regards, Ali
|
|
From: Per W. <pw...@ia...> - 2003-02-18 00:17:44
|
On Tue, 18 Feb 2003, Ioannis Vranos wrote: > -------Original Message------- > > From: Catsquotl > Date: =C4=E5=F5=F4=DD=F1=E1, 17 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 2:= 21:19 =EC=EC > To: dev...@li... > Subject: [Dev-C++] differnece between system pause and cin.get() > > Hello, > > Obviously there are quite a lot of differences between the two. > However since I am new to c++ and pragramming all together i was wonderin= g > why cin.get() > works sometimes to pauze the system after a programm and sometimes it won= `t. > > =3D=3D> Because one or more '\n' has remain in the stream from previous c= in > use(s). > > > It seems to me that cin.get() before return 0; > would use less memory than system pause. > > =3D=3D> It depends on how many things are written inside get(). However t= he > member function call is usually faster than a regular function call. But = i > do not think you should be so space/time concerned. :) For just about any type of programming, you may ignore any speed difference between member call and regular function call. For a new normal PC, we are talking nano-seconds. A member function call is normally just a teeny bit slower, since it is a regular call with the extra requirement that it must send a 'this' pointer in registers or on the stack. If the member function is virtual, the member call must also perform the call indirect, by locating the call address in the VMT for the object. The only time a member call is as fast as a regular function call is if the member function is declared static - but then it is a regular function declared in the namespace of the class. What is important in this case is that system() is special. It is a request to start a new program 'PAUSE' and wait for that program to end, i.e. wait until you press a character. This is not the slightest problem for testing a debug-version of a program. However, in real production code, some care should be taken about the use of system() calls, because of the very large amount of work the os has to do to perform the call. One call to system() might sound nice, but probably represents 100-10000 calls or more depending on what type of command that are put as argument. The OS has to start a new proces, with new stack... and might in some cases consume more memory and/or cpu time for the system() call than for the rest of the application. /Per W > > Ioannis Vranos > > * Programming pages: http://www.noicys.freeurl.com > * Alternative URL: http://run.to/noicys |
|
From: Robson B. <rob...@su...> - 2003-02-17 23:55:27
|
the function system() is a shortcut to use dos comands like system("ATTRIB")
or system("PAUSE"). cin.get() is a c++ function that you can adjust
settings. is more flexible. that was what i verified.
[]'s
----- Original Message -----
From: Catsquotl
To: dev...@li...
Sent: Monday, February 17, 2003 8:21 PM
Subject: Re: [Dev-C++] differnece between system pause and cin.get()
At 00:24 18-2-2003 +0200, Ioannis Vranos wrote:
-------Original Message-------
From: Catsquotl
Date: ÄåõôÝñá, 17 ÖåâñïõÜñéïò 2003 2:21:19 ìì
To: dev...@li...
Subject: [Dev-C++] differnece between system pause and cin.get()
Hello,
Obviously there are quite a lot of differences between the two.
However since I am new to c++ and pragramming all together i was
wondering
why cin.get()
works sometimes to pauze the system after a programm and sometimes it
won`t.
==> Because one or more '\n' has remain in the stream from previous cin
use(s).
Thanks for the response.
Is there a way of chekking if there`s annything left in the cin stream.
Or to empty it for that matter before using it as a tool for keeping dos
boxes open :-)
greets Cat
|
|
From: Robson B. <rob...@su...> - 2003-02-17 23:51:06
|
Thanks for the input Astar, but in my instalation of Dev-cpp does not exist
the /bit directory. I use Dev-cpp 4.01. Should i downloads v5.0? Oh, my gcc
is 2.9.
It worked but not fully. It created the file but the size was 0kb. I would
like to store in a binary file the high scores of my game. This way would
prevent the player to change the score if the score file was just a txt
file.
class hiscore {
public:
int score;
int level;
int pickups;
char name[21];
}
----- Original Message -----
From: "Astar" <As...@tu...>
To: <dev...@li...>
Sent: Sunday, February 16, 2003 1:07 AM
Subject: Re: [Dev-C++] Binary
Hello Robson,
Saturday, February 15, 2003, 9:43:44 PM, you wrote:
RB> Well, i'm working with <fstream> routines and want to create a file to
save
RB> binary data but it's not working. An error occurs when trying to compile
the
RB> following line:
RB> ofstream fout("datafile.dat", ios_base::binary);
i overcome this eroor some hours ago :)
if you use gcc 3.2
write:
std::ofstrem( "data.txt", std::ios::binary );
don't include "ios_base.h" and other internal headers. include
<fstream>
and add to include's settings C:\Dev-Cpp\include\c++\mingw32\bits
or just copy all files form there to C:\Dev-Cpp2\include\c++\bits
but If You use any previous gcc/mingsw32 just write:
ofstrem( "data.txt", std::binary );
--
Astar mailto:
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
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: Catsquotl <C.a...@hc...> - 2003-02-17 23:21:08
|
At 00:24 18-2-2003 +0200, Ioannis Vranos wrote: >-------Original Message------- > >From: <mailto:C.a...@hc...>Catsquotl >Date: =C4=E5=F5=F4=DD=F1=E1, 17 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003= 2:21:19 =EC=EC >To:=20 ><mailto:dev...@li...>dev...@li...= .net >Subject: [Dev-C++] differnece between system pause and cin.get() > >Hello, > >Obviously there are quite a lot of differences between the two. >However since I am new to c++ and pragramming all together i was wondering >why cin.get() >works sometimes to pauze the system after a programm and sometimes it= won`t. >=3D=3D> Because one or more '\n' has remain in the stream from previous cin= =20 >use(s). > Thanks for the response. Is there a way of chekking if there`s annything left in the cin stream. Or to empty it for that matter before using it as a tool for keeping dos=20 boxes open :-) greets Cat=20 |
|
From: Ioannis V. <no...@ho...> - 2003-02-17 22:36:57
|
-------Original Message-------=0D =0D From: Torsten Curdt=0D Date: =C4=E5=F5=F4=DD=F1=E1, 17 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 4:= 42:55 =EC=EC=0D To: dev...@li...=0D Subject: [Dev-C++] unicode=0D =0D I just switched my application to unicode by specifying the=0D "-D UNICODE" and "-D _UNICODE" compiler options.=0D =0D But the STL string class refused to accept that. Though=0D it uses the "charT" type.=0D =0D Any pointers how to switch it to unicode?=0D =0D =0D =3D=3D> Try using wchar_t *built in* type which is also portable. And for= string use basic_string<wchar_t>.=0D =0D For example:=0D =0D // L in front converts a regular string to wchar_t.=0D basic_string<wchar_t> s=3DL"Something";=0D =0D =0D The string type is nothing else than:=0D =0D typedef basic_string<char> string;=0D =0D =0D For wide character sets, wchar_t is your type and where UNICODE is suppor= ted it usually is UNICODE.=0D =0D =0D Unfortunately (& strangely) i have the impression that MINGW does not provide wcout, so in this case you will have to use the C-subset wprintf(= ) in the style:=0D =0D wprintf(L"%s\n", s);=0D =0D =0D Try being as much portable as possible. In this way you will have fewer incompatibilities with other compilers or even next releases of your compiler.=0D =0D Ioannis Vranos=0D =0D * Programming pages: http://www.noicys.freeurl.com=0D * Alternative URL: http://run.to/noicys=20 |
|
From: Ioannis V. <no...@ho...> - 2003-02-17 22:29:09
|
-------Original Message-------=0D =0D From: Lars-Bo Jacobsen=0D Date: =C4=E5=F5=F4=DD=F1=E1, 17 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 2:= 58:01 =EC=EC=0D To: 'Ioannis Vranos'; dev...@li...=0D Subject: SV: [Dev-C++] Cannot compile using Dev-C++ 5.0 beta 7 (4.9.7.0) = (10 MB) with Min=0D =0D Well that really does not help on the stated problem. I have the exact sa= me problem, I have developed a program with the gcc 2.95.3 version of Dev-Cp= p then I changed my dev-Cpp to the version with gcc 3.2 because I wanted to experiment with wxWindows 2.4. No problem at all, I went thru some tutori= al on wxWindows and everything works fine.=0D =0D But today I needed to make a change to my original project developed with gcc 2.95.3 and I get the same errors and a lot of them (and all my includ= es are correct). But due to this thread I realize that none of my wxWindows test/tutorial programs uses iostream hence the problem with gcc 3.2 first appeared today.=0D =0D Of course I realize that the problem could lay somewhere else then in the dev-cpp distribution but I have tried to install it on an NT4 and an xp machine and the same problem arise. So I will solve this the same way as Martin Clausen(copying from one .\bits directory to the other) anyway I g= lad I am not the only one who experienced this problem hope someone not as newbies as I will have the insight to understand what=92s going on.=0D =0D =0D =3D=3D> It seems to me it is some system-dependent calls that cause the p= roblems and since it is fixed by using the files of a MINGW bits folder, then it= is a bug of Dev-C++ for not including that path? Whether it is of Dev-C++ or not, i suppose it can be fixed from inside Dev-C++ by adding that folder = to the Dev-C++ used path folders.=0D =0D =0D Ioannis Vranos=0D =0D * Programming pages: http://www.noicys.freeurl.com=0D * Alternative URL: http://run.to/noicys=20 |
|
From: Ioannis V. <no...@ho...> - 2003-02-17 22:24:58
|
-------Original Message-------=0D =0D From: Catsquotl=0D Date: =C4=E5=F5=F4=DD=F1=E1, 17 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 2:= 21:19 =EC=EC=0D To: dev...@li...=0D Subject: [Dev-C++] differnece between system pause and cin.get()=0D =0D Hello,=0D =0D Obviously there are quite a lot of differences between the two.=0D However since I am new to c++ and pragramming all together i was wonderin= g =0D why cin.get()=0D works sometimes to pauze the system after a programm and sometimes it won= `t.=0D =0D =3D=3D> Because one or more '\n' has remain in the stream from previous c= in use(s).=0D =0D =0D It seems to me that cin.get() before return 0;=0D would use less memory than system pause.=0D =0D =3D=3D> It depends on how many things are written inside get(). However t= he member function call is usually faster than a regular function call. But = i do not think you should be so space/time concerned. :)=0D =0D =0D Ioannis Vranos=0D =0D * Programming pages: http://www.noicys.freeurl.com=0D * Alternative URL: http://run.to/noicys=20 |
|
From: Torsten C. <tc...@df...> - 2003-02-17 14:41:45
|
I just switched my application to unicode by specifying the "-D UNICODE" and "-D _UNICODE" compiler options. But the STL string class refused to accept that. Though it uses the "charT" type. Any pointers how to switch it to unicode? -- Torsten |
|
From: Martin C. <mar...@ho...> - 2003-02-17 13:25:38
|
Hi All, I have found the following faq by Eric S. Raymond a very useful guide, in how to write questions that get me effective answers. http://www.catb.org/~esr/faqs/smart-questions.html Martin _________________________________________________________________ Tag MSN Hotmail med dig på mobilen http://www.msn.dk/mobile |
|
From: Lars-Bo J. <la...@fo...> - 2003-02-17 12:58:06
|
Well that really does not help on the stated problem. I have the exact =
same
problem, I have developed a program with the gcc 2.95.3 version of =
Dev-Cpp
then I changed my dev-Cpp to the version with gcc 3.2 because I wanted =
to
experiment with wxWindows 2.4. No problem at all, I went thru some =
tutorial
on wxWindows and everything works fine.<?xml:namespace prefix =3D o ns =
=3D
"urn:schemas-microsoft-com:office:office" />
=20
But today I needed to make a change to my original project developed =
with
gcc 2.95.3 and I get the same errors and a lot of them (and all my =
includes
are correct). But due to this thread I realize that none of my =
wxWindows
test/tutorial programs uses iostream hence the problem with gcc 3.2 =
first
appeared today.
=20
Of course I realize that the problem could lay somewhere else then in =
the
dev-cpp distribution but I have tried to install it on an NT4 and an xp
machine and the same problem arise. So I will solve this the same way =
as
Martin Clausen(copying from one ....\bits directory to the other) =
anyway I
glad I am not the only one who experienced this problem hope someone =
not as
newbies as I will have the insight to understand what's going on.
=20
Regards
=20
Lars-Bo
-----Oprindelig meddelelse-----
Fra: Ioannis Vranos [mailto:no...@ho...]
Sendt: 16. februar 2003 14:27
Til: dev...@li...
Emne: Re: [Dev-C++] Cannot compile using Dev-C++ 5.0 beta 7 (4.9.7.0) =
(10
MB) with Min
iostream.h is not proper C++. After the official ANSI/ISO C++ standard
ratification, standard library header files have no .h extension except =
of
the C subset. Everything is defined in namespace std. Example:
=20
#include <iostream>
=20
int main()
{
std::cout<<"Hello new world!\n";
=20
return 0;
}
=20
The C subset header files also exist in the form <cxxxx>, e.g. =
<cstdlib> and
everything in them is also defined in namespace std. Example:
=20
#include <iostream>
#include <cstdlib>
=20
int main()
{
using namespace std;
=20
cout<<"Hello new world!\n";
=20
system("pause");
=20
return 0;
}
=20
=20
A slow thorough read of an up to date C++ book will have much to offer.
=20
=20
Ioannis Vranos
* Programming pages: http://www.noicys.freeurl.com
<http://www.noicys.freeurl.com/>=20
* Alternative URL: http://run.to/noicys <http://run.to/noicys> =20
=20
-------Original Message-------
=20
From: Martin Clausen <mailto:mar...@ho...>=20
Date: =CA=F5=F1=E9=E1=EA=DE, 16 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 =
12:22:31 =EC=EC
To: dev...@li...
<mailto:dev...@li...>=20
Subject: Re: [Dev-C++] Cannot compile using Dev-C++ 5.0 beta 7 =
(4.9.7.0) (10
MB) with Min
=20
Hi again,
Thanks for input Robson. The only iostream.h file in all directories =
under=20
Dev-Cpp is in C:\Dev-Cpp\include\c++\backward.
I swear I haven't touched a single thing :-) - just installed and run =
out of
the box. How do I get the compiler to find the iostream.h file ? and =
all the
other legacy files ? or is there somthing more fundametally wrong with =
my=20
setup ? do you have iostream.h located somewhere else ?
Just so I don't waste anybodys time, the problem only arises when I =
used the
latest version with Mingw/GCC 3.2 - with Mingw/GCC 2.95.3 everything =
works=20
fine.
Martin
_________________________________________________________________
Find din ferie p=E5 MSN Rejser http://www.msn.dk/rejser
<http://www.msn.dk/rejser>=20
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf <http://thinkgeek.com/sf>=20
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
<mailto:Dev...@li...>=20
TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
<http://www.noicys.cjb.net/devcpp/ub.htm>=20
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users=20
=09
|
|
From: Catsquotl <C.a...@hc...> - 2003-02-17 12:19:26
|
Hello, Obviously there are quite a lot of differences between the two. However since I am new to c++ and pragramming all together i was wondering why cin.get() works sometimes to pauze the system after a programm and sometimes it won`t. It seems to me that cin.get() before return 0; would use less memory than system pause. greets Catsquotl |
|
From: Michel W. <mic...@fr...> - 2003-02-17 08:42:02
|
Nilo Roberto da Cruz Paim wrote: > hi all, > i have just downloaded and installed Dev-C++ 5.0 beta 7 (4.9.7.0) with > Mingw/GCC 2.95.3 on Win 98 system. > > Everything is working ok, except when I try to use wxWindows, that I > got from devpack "WxWindows-2.2.9.DevPak". It compiles a simple > program generated directly from wxWndows template, but it results in a > lot of linker errors (undefined references). > > What am I missing? Could you send me the errors ? > > TIA > > Nilo R C Paim > np...@ho... > Porto Alegre - RS - Brasil > > > _________________________________________________________________ > Protect your PC - get McAfee.com VirusScan Online > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > 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 > |