dev-cpp-users Mailing List for Dev-C++ (Page 187)
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: Alvin T. <alv...@th...> - 2004-08-26 03:27:33
|
Noorez Kassam wrote: > sorry, another thing came across my mind.. > > In some tutorials, when they talked about exporting functions, they used > _cdecl (or something like that). What is that for? it tells the compiler to expose that item for export (so it can be externally linked). if you see a define like 'DLLEXPORT' it usually is that. -alvin |
|
From: Alvin T. <alv...@th...> - 2004-08-26 03:19:21
|
Noorez Kassam wrote: > In the tutorials that I read, they say that the dllMain() function needs > to be in C code. (use extern "C" if writing in c++). Do I have to do > that if my dll will just be used by C++ code? yes. > And the functions that I export in the dll, do they also have to use the > extern "C" command as well? no. > One more, if I wrote a function using c++ components, then would extern > "C" cause errors because it doesn't recognize the code because of being > compiled as C of will the name just be exported without mangling... yes. -alvin |
|
From: Noorez K. <coo...@ho...> - 2004-08-25 22:03:24
|
sorry, another thing came across my mind.. In some tutorials, when they talked about exporting functions, they used _cdecl (or something like that). What is that for? _________________________________________________________________ MSN® Calendar keeps you organized and takes the effort out of scheduling get-togethers. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. |
|
From: Noorez K. <coo...@ho...> - 2004-08-25 21:26:10
|
I have some questions for dll writing. In the tutorials that I read, they say that the dllMain() function needs to be in C code. (use extern "C" if writing in c++). Do I have to do that if my dll will just be used by C++ code? And the functions that I export in the dll, do they also have to use the extern "C" command as well? One more, if I wrote a function using c++ components, then would extern "C" cause errors because it doesn't recognize the code because of being compiled as C of will the name just be exported without mangling... _________________________________________________________________ Take charge with a pop-up guard built on patented Microsoft® SmartScreen Technology http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. |
|
From: Kiryl V M. <ki...@ea...> - 2004-08-25 16:23:35
|
> "operator=3D default version C& C::operator=3D(const &);" > The & follows the variable (?). Are you sure that it follows the variable. Maybe what you think is a = variable in fact is a type definition. Check it. > 8: CAT (const CAT &); =20 Here, "const CAT" is type, not variable. When you _declare_ some method, = you can omit variable. Like in this case. > 27: CAT::CAT(const CAT & rhs) Here, "const CAT" is type, and "rhs" is variable/object. As I mentioned = before, when you declare a function or method in the class (.h file), = you may omit the variable/object in declaration. But when you write a = function/method itself in implementation file, then you specify this = variable/object. I am pretty sure, that in the first example above, what precedes the = ampersand is type. Regards, |
|
From: Per W. <pw...@ia...> - 2004-08-25 14:09:44
|
This seems like a good location for the file. Exactly why are you asking? Don't you have the file, or does plot.cpp fail to compile or...? /Per W On Wed, 25 Aug 2004, Todd Gardner wrote: > Hello everyone, > > I am using dev-cpp version 4.9.8.0 on Windows 2000. > > How can I tell if this is the proper location for the file image.h? > > The current location is... > C:\Dev-Cpp\include\wx\image.h > > The file plot.cpp contains... > #include "wx/image.h" > > Any suggestions or redirections would be greatly appreciated. > > Todd > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Per W. <pw...@ia...> - 2004-08-25 14:06:54
|
A couple of questions: - Max number of entries you need to store? - Max size of the entries? - Is it ok if all entries in a "table" is of same size, or must they be variable-sized? - Must you be able to walk through the entries in different order without loading the complete file to memory? A lot of programs uses ordinary binary files for quite a lot functions. They can handle many million entries. The are very, very easy to use as long as each entry is of fixed size. Then it is possible to evaluate the position of any entry in the file. However, in the file they are sorted in the same order they were added, so to retrieve a customer from a phone book, a lot of entries must be loaded to locate the entry for a specific customer. If you need more advanced functions, you are best of using a real database, such as MySQL or similar. A simple alternative in the middle might be to use Berkeley DB database files. It supports variable-sized entries ordered on a single search index. /Per W On Wed, 25 Aug 2004, THAMAE wrote: > Hi All! > > I am trying to develop a small database that reads and writes records to a text file and as I save more records to the file it gets corrupt. Is there an alternative to writing to a text file except advanced databeses such as Excel? > > Thanx all. > > Thamae > > > --------------------------------- > Do you Yahoo!? > Y! Messenger - Communicate in real time. Download now. |
|
From: Reid T. <Rei...@at...> - 2004-08-25 13:53:13
|
sqlite - www.sqlite.org =20 =20 reid=20 -----Original Message----- From: THAMAE [mailto:m_t...@ya...]=20 Sent: Wednesday, August 25, 2004 8:46 AM To: Dev-C++ Subject: [Dev-C++] Reading and Writing to a file =09 =09 Hi All! =20 I am trying to develop a small database that reads and writes records to a text file and as I save more records to the file it gets corrupt. Is there an alternative to writing to a text file except advanced databeses such as Excel? =20 Thanx all. =20 Thamae =09 _____ =20 Do you Yahoo!? Y! Messenger <http://us.rd.yahoo.com/mail_us/taglines/msgr/evt=3D26088/*http://messeng= e r.yahoo.com> - Communicate in real time. Download now. |
|
From: Todd G. <pi...@ea...> - 2004-08-25 13:29:39
|
Hello everyone, I am using dev-cpp version 4.9.8.0 on Windows 2000. How can I tell if this is the proper location for the file image.h? The current location is... C:\Dev-Cpp\include\wx\image.h The file plot.cpp contains... #include "wx/image.h" Any suggestions or redirections would be greatly appreciated. Todd |
|
From: Mike P. <Mi...@gp...> - 2004-08-25 13:19:23
|
Am I missing something with debugging in bloodshed I have read the help files but cant get the debugger to work=20 Eg in the help it says enable debugging in the compiler/options/linker tree to generate debugging information this is set to yes=20 And if I type help in the text field and hit the button send command to GDB nothing happens. I am a bit new to bloodshed and c/c++ but am quite hooked and would like to be able to step through code (not that I ever get any logic bugs *@^?) Thanks in advance =20 Mike P=20 =20 =20 |
|
From: Damien A <g_...@ho...> - 2004-08-25 13:01:50
|
What version of gcc are you using? Are you using c++ functions for file i/o (fstreams) or c functions? I experienced file corruption a while back when using fstreams in gcc/g++ packages before version 3.4.0. Seems to be fixed now. ----Original Message Follows---- From: THAMAE <m_t...@ya...> To: Dev-C++ <dev...@li...> Subject: [Dev-C++] Reading and Writing to a file Date: Wed, 25 Aug 2004 05:45:44 -0700 (PDT) MIME-Version: 1.0 Hi All! I am trying to develop a small database that reads and writes records to a text file and as I save more records to the file it gets corrupt. Is there an alternative to writing to a text file except advanced databeses such as Excel? Thanx all. Thamae --------------------------------- Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. _________________________________________________________________ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail |
|
From: THAMAE <m_t...@ya...> - 2004-08-25 12:45:59
|
Hi All! I am trying to develop a small database that reads and writes records to a text file and as I save more records to the file it gets corrupt. Is there an alternative to writing to a text file except advanced databeses such as Excel? Thanx all. Thamae --------------------------------- Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. |
|
From: Per W. <pw...@ia...> - 2004-08-25 07:33:55
|
Just a footnote. lhs and rhs are not common expressions. Most computer
language books talks about l-val and r-val for left-hand and right-hand
expressions.
/Per W
On Wed, 25 Aug 2004, Per Westermark wrote:
> First of all, a reference is just a special case of a pointer. The
> "special" is that you must assign an address to it by specifying another
> variable for it to reference.
>
> Second "special" is that you can not change what a reference variable
> points to, while a pointer may be modified any number of times.
>
> Third "special" is that you don't use the normal pointer indirection code,
> i.e. p->xx or *p when using a reference variable, but may use it directly
> as in: ref.xx or just ref.
>
>
> When you declare a variable as a reference type, the & binds to the
> variable/parameter name, not to the type. This sarts to make sense when
> you declare more than one variable, as in:
>
> // Create two integer variables, and give them values.
> int a = 10,b=12;
>
> // Now create two reference variables pointing at a and b
> int &my_ref_a = a,&my_ref_b = b;
>
> // Now it is possible to change the value of b by:
> my_ref_b = 100;
>
> // Emit new value (100).
> std::cout << b << std::endl;
>
> If & hand bound to the type instead, the above variable declarations
> would have looked like:
> int& my_ref_var1 = a,my_ref_var2 = b;
> i.e. you would only have needed _one_ & while declaring two variables of
> type reference to integer. Observe however, that the above does something
> completely different from the first line. Since & binds to the variable,
> my_ref_var1 has a & before it, and is a reference to an integer variable
> (a), while my_ref_var2 _doesn't_ have a & before, so it is just an integer
> variable getting a copy of the value of variable b, i.e. later assign to
> my_ref_b will not change the value of b.
>
> It is the same for pointer types, i.e. when creating pointer variables to
> int, each individual pointer variable needs it's own *, since * isn't
> bound to the int type:
>
> int *ptr1,*ptr2,*ptr3;
>
> In your examples, i.e. when specifying a parameter of reference type, it
> isn't obvious reference (or pointer) binds to left or right (to type or
> variable), since each parameter must have it's own type declaration:
> void fnk(int &a,int &b) {}
> where the following is invalid because b doesn't have a type specified:
> void fnk(int &a,&b) {}
>
> Your question about line 8 isn't so strange. When declaring a function
> prototype (or operator prototype), you might skip writing the parameter
> name, as in:
>
> int my_function(int &);
>
> int my_function(int &ref_param) {
> return ++ref_param;
> }
>
> but
> int my_function(int &);
> (your line 8) is identical to
> int my_funcion(int&);
> since white-space doesn't matter, or
> int my_function(int &one_parameter_name);
> since existence of parameter names doesn't matter in a function prototype,
> only the type of the parameters.
>
>
>
> Once more:
> int my_function(int &);
> _doesn't_ have the & last, since there is an "invisible" :) parameter name
> following it. It is just a lazy short-form of declaration.
>
>
>
> lhs/rhs is indeed left-hand-side and right-hand-side and is important in
> assignment operations.
> lhs = rhs;
> where lhs may not be a const variable since the assignment will try to
> change the value of lhs.
>
> Another example where rhs and rhs are important is when & is used as
> address-of operator (instead of a delcaration of a reference variable). It
> isn't possible to change the address of a variable. If it is global/auto,
> it has a fixed address and if it is a dynamically allocated variable the
> address is set by new/malloc.
>
> int a = 10,b = 12;
>
> a = b; // OK. a now set to 12
> &a = &b; // NOT OK. Can't _move_ a.
>
> int *pa = &a; *pb = &b;
> *pa = b; // OK. pa points to a, so a gets set to value of b.
> pa = &b; // OK. pa now points to b instead of pointing to a.
>
> int &refa = a,&refb = b;
> refa = b; // OK. a now set to 12.
> refa = refb; // OK. a now set to 12.
>
>
>
> One special thing to think about is that a reference may only be set once.
> If the referene variable is a member of a class, it must be set by the
> constructor, i.e.
>
> class MyClass {
> int &m_ref;
> public:
> MyClass(int ¶m) : m_ref(param) {}
> setval(int v) { m_ref = v; }
> }
>
> int main() {
> int a = 10;
> MyClass mc(a);
>
> mc.setval(12); // a now changed to value 12
> }
>
>
> If the reference variable is global or auto, it must be assigned
> immediately in the declaration, i.e.
> int a;
> int &aref = a; // Let aref reference (or point to) a
> int &aref2; // Invalid - can't have uninitialized references!
>
> /Per W
>
> On Tue, 24 Aug 2004, Roger Furer wrote:
>
> > Aloha from Honolulu,
> > I've been learning C++ using "Sam's Teach Yourself C++" and when I
> > came across "Effective C++ Second Edition" in a used-book store, I
> > picked it up (both books mention each other). My reference book had
> > been "Turbo C/C++ The Complete Reference (Second Edition)" which was
> > copyright 1992 (I was using Windows 3.1 and Borland's Turbo C++ 3).
> > Finding the reference to be so out-of-date, I bought a new one: "The
> > Complete Reference C++ Fourth Edition". This has a 2003 copyright and
> > is much more up-to-date. I find it very useful when looking up
> > specifics of things mentioned in the first two books.
> >
> > My questions for the group have to do with using the ampersand (&)
> > for references.
> >
> > First: in "Effective C++", item 15, p. 65:
> > "operator= default version C& C::operator=(const C&);"
> > The & follows the variable (?).
> >
> > But in "The Complete Reference" on p. 347 the author states
> > "... as specified in the C++ syntax, when used in a
> > declaration, the * (or &) is linked to the individual variable that it
> > _/precedes/_, (my emphasis) not to the type that it follows."
> >
> > Second: In both "Sam's Teach Yourself..." and "Effective C++" the
> > authors use "rhs" and "lhs" throughout.
> > Example from "Teach Yourself C++" p.203: defining a class called
> > "CAT" the following is the declaration for the copy constructor on line 8:
> > 8: CAT (const CAT &); // copy constructor
> > Later on line 27 it is defined:
> > 27: CAT::CAT(const CAT & rhs)
> > 28: { ... the definition continues...
> >
> > The author makes it clear that "rhs" stands for "right hand side" and
> > "lhs" for "left hand side" and from the way they use them I have a
> > pretty good idea of what they mean, but I can find no mention of either
> > one in "The Complete Reference" and nowhere is there anything like line
> > 8 above: (const CAT &) where the & is at the end.
> >
> > Can anyone clear this up for me?
> >
> > Much thanks in advance.
> > Mahalo,
> > Roger
> >
> >
> >
> >
> > -------------------------------------------------------
> > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Per W. <pw...@ia...> - 2004-08-25 06:49:54
|
First of all, a reference is just a special case of a pointer. The
"special" is that you must assign an address to it by specifying another
variable for it to reference.
Second "special" is that you can not change what a reference variable
points to, while a pointer may be modified any number of times.
Third "special" is that you don't use the normal pointer indirection code,
i.e. p->xx or *p when using a reference variable, but may use it directly
as in: ref.xx or just ref.
When you declare a variable as a reference type, the & binds to the
variable/parameter name, not to the type. This sarts to make sense when
you declare more than one variable, as in:
// Create two integer variables, and give them values.
int a = 10,b=12;
// Now create two reference variables pointing at a and b
int &my_ref_a = a,&my_ref_b = b;
// Now it is possible to change the value of b by:
my_ref_b = 100;
// Emit new value (100).
std::cout << b << std::endl;
If & hand bound to the type instead, the above variable declarations
would have looked like:
int& my_ref_var1 = a,my_ref_var2 = b;
i.e. you would only have needed _one_ & while declaring two variables of
type reference to integer. Observe however, that the above does something
completely different from the first line. Since & binds to the variable,
my_ref_var1 has a & before it, and is a reference to an integer variable
(a), while my_ref_var2 _doesn't_ have a & before, so it is just an integer
variable getting a copy of the value of variable b, i.e. later assign to
my_ref_b will not change the value of b.
It is the same for pointer types, i.e. when creating pointer variables to
int, each individual pointer variable needs it's own *, since * isn't
bound to the int type:
int *ptr1,*ptr2,*ptr3;
In your examples, i.e. when specifying a parameter of reference type, it
isn't obvious reference (or pointer) binds to left or right (to type or
variable), since each parameter must have it's own type declaration:
void fnk(int &a,int &b) {}
where the following is invalid because b doesn't have a type specified:
void fnk(int &a,&b) {}
Your question about line 8 isn't so strange. When declaring a function
prototype (or operator prototype), you might skip writing the parameter
name, as in:
int my_function(int &);
int my_function(int &ref_param) {
return ++ref_param;
}
but
int my_function(int &);
(your line 8) is identical to
int my_funcion(int&);
since white-space doesn't matter, or
int my_function(int &one_parameter_name);
since existence of parameter names doesn't matter in a function prototype,
only the type of the parameters.
Once more:
int my_function(int &);
_doesn't_ have the & last, since there is an "invisible" :) parameter name
following it. It is just a lazy short-form of declaration.
lhs/rhs is indeed left-hand-side and right-hand-side and is important in
assignment operations.
lhs = rhs;
where lhs may not be a const variable since the assignment will try to
change the value of lhs.
Another example where rhs and rhs are important is when & is used as
address-of operator (instead of a delcaration of a reference variable). It
isn't possible to change the address of a variable. If it is global/auto,
it has a fixed address and if it is a dynamically allocated variable the
address is set by new/malloc.
int a = 10,b = 12;
a = b; // OK. a now set to 12
&a = &b; // NOT OK. Can't _move_ a.
int *pa = &a; *pb = &b;
*pa = b; // OK. pa points to a, so a gets set to value of b.
pa = &b; // OK. pa now points to b instead of pointing to a.
int &refa = a,&refb = b;
refa = b; // OK. a now set to 12.
refa = refb; // OK. a now set to 12.
One special thing to think about is that a reference may only be set once.
If the referene variable is a member of a class, it must be set by the
constructor, i.e.
class MyClass {
int &m_ref;
public:
MyClass(int ¶m) : m_ref(param) {}
setval(int v) { m_ref = v; }
}
int main() {
int a = 10;
MyClass mc(a);
mc.setval(12); // a now changed to value 12
}
If the reference variable is global or auto, it must be assigned
immediately in the declaration, i.e.
int a;
int &aref = a; // Let aref reference (or point to) a
int &aref2; // Invalid - can't have uninitialized references!
/Per W
On Tue, 24 Aug 2004, Roger Furer wrote:
> Aloha from Honolulu,
> I've been learning C++ using "Sam's Teach Yourself C++" and when I
> came across "Effective C++ Second Edition" in a used-book store, I
> picked it up (both books mention each other). My reference book had
> been "Turbo C/C++ The Complete Reference (Second Edition)" which was
> copyright 1992 (I was using Windows 3.1 and Borland's Turbo C++ 3).
> Finding the reference to be so out-of-date, I bought a new one: "The
> Complete Reference C++ Fourth Edition". This has a 2003 copyright and
> is much more up-to-date. I find it very useful when looking up
> specifics of things mentioned in the first two books.
>
> My questions for the group have to do with using the ampersand (&)
> for references.
>
> First: in "Effective C++", item 15, p. 65:
> "operator= default version C& C::operator=(const C&);"
> The & follows the variable (?).
>
> But in "The Complete Reference" on p. 347 the author states
> "... as specified in the C++ syntax, when used in a
> declaration, the * (or &) is linked to the individual variable that it
> _/precedes/_, (my emphasis) not to the type that it follows."
>
> Second: In both "Sam's Teach Yourself..." and "Effective C++" the
> authors use "rhs" and "lhs" throughout.
> Example from "Teach Yourself C++" p.203: defining a class called
> "CAT" the following is the declaration for the copy constructor on line 8:
> 8: CAT (const CAT &); // copy constructor
> Later on line 27 it is defined:
> 27: CAT::CAT(const CAT & rhs)
> 28: { ... the definition continues...
>
> The author makes it clear that "rhs" stands for "right hand side" and
> "lhs" for "left hand side" and from the way they use them I have a
> pretty good idea of what they mean, but I can find no mention of either
> one in "The Complete Reference" and nowhere is there anything like line
> 8 above: (const CAT &) where the & is at the end.
>
> Can anyone clear this up for me?
>
> Much thanks in advance.
> Mahalo,
> Roger
>
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Roger F. <ra...@ha...> - 2004-08-25 04:46:32
|
Aloha from Honolulu,
I've been learning C++ using "Sam's Teach Yourself C++" and when I
came across "Effective C++ Second Edition" in a used-book store, I
picked it up (both books mention each other). My reference book had
been "Turbo C/C++ The Complete Reference (Second Edition)" which was
copyright 1992 (I was using Windows 3.1 and Borland's Turbo C++ 3).
Finding the reference to be so out-of-date, I bought a new one: "The
Complete Reference C++ Fourth Edition". This has a 2003 copyright and
is much more up-to-date. I find it very useful when looking up
specifics of things mentioned in the first two books.
My questions for the group have to do with using the ampersand (&)
for references.
First: in "Effective C++", item 15, p. 65:
"operator= default version C& C::operator=(const C&);"
The & follows the variable (?).
But in "The Complete Reference" on p. 347 the author states
"... as specified in the C++ syntax, when used in a
declaration, the * (or &) is linked to the individual variable that it
_/precedes/_, (my emphasis) not to the type that it follows."
Second: In both "Sam's Teach Yourself..." and "Effective C++" the
authors use "rhs" and "lhs" throughout.
Example from "Teach Yourself C++" p.203: defining a class called
"CAT" the following is the declaration for the copy constructor on line 8:
8: CAT (const CAT &); // copy constructor
Later on line 27 it is defined:
27: CAT::CAT(const CAT & rhs)
28: { ... the definition continues...
The author makes it clear that "rhs" stands for "right hand side" and
"lhs" for "left hand side" and from the way they use them I have a
pretty good idea of what they mean, but I can find no mention of either
one in "The Complete Reference" and nowhere is there anything like line
8 above: (const CAT &) where the & is at the end.
Can anyone clear this up for me?
Much thanks in advance.
Mahalo,
Roger
|
|
From: Noorez K. <coo...@ho...> - 2004-08-25 04:04:48
|
I am trying to learn how to write dll files and I have some questions. When I make a project that uses the dll I have to link in the library that was made my the dll project. But i did a test and when i changed the dll file and didn't recompile the other project, the program read the new dll file. How does that work? And how can I use the dll function thing... I only know how to export stuff from the dll. _________________________________________________________________ Designer Mail isn't just fun to send, it's fun to receive. Use special stationery, fonts and colors. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. |
|
From: William Mc C. <WIL...@ms...> - 2004-08-24 14:20:40
|
Good Morning:
This is just a warning.=20
My OS is MS "XP". I also have MSN as my ISP. I installed the =
latest MSN Service pack (SP2). Wow did this turn out to be a big =
headache.
My advice is wait till MSN fixes this package!
I had to to delete everything and reinstall MSN 9 What a piece =
of CRAP.
Have a great =
day. |
|
From: Per W. <pw...@ia...> - 2004-08-24 07:22:19
|
Any good C/C++ book should describe operator precedence. Addition is evaluated from left to right, i.e. as: a =3D ((b+c)+d); Assignment is evaluated right to left, i.e. as: a=3D(c=3Dd); /Per W On Mon, 23 Aug 2004, Noorez Kassam wrote: > I am confused with chaining operators. > > if i had something like this > > int a,b,c,d; > a =3D b+c+d which two parts are done first and to where is that value ret= ured > for the second part. > > and also this > > a=3Dc=3Dd; > > how does that work... > > _________________________________________________________________ > Designer Mail isn't just fun to send, it's fun to receive. Use special > stationery, fonts and colors. > http://join.msn.com/?pgmarket=3Den-ca&page=3Dbyoa/prem&xAPID=3D1994&DI=3D= 1034&SU=3Dhttp://hotmail.com/enca&HL=3DMarket_MSNIS_Taglines > Start enjoying all the benefits of MSN=AE Premium right now and get the > first two months FREE*. > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Jamie K. <ja...@pc...> - 2004-08-24 06:25:28
|
Hi, Is it possible to use files from the windows sdk in dev-c++? I want to = try and play arround with upnp functions and the only way i can do that = is through using header files from the windows sdk. Any feedback will be = helpfull! Thanks Jamie |
|
From: Noorez K. <coo...@ho...> - 2004-08-24 02:22:05
|
I am confused with chaining operators. if i had something like this int a,b,c,d; a = b+c+d which two parts are done first and to where is that value retured for the second part. and also this a=c=d; how does that work... _________________________________________________________________ Designer Mail isn't just fun to send, it's fun to receive. Use special stationery, fonts and colors. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. |
|
From: Daniel K. O. <dan...@ya...> - 2004-08-24 02:20:11
|
Noorez Kassam wrote:
> extern "C"
> {
>
> struct anything
> {
> int a;
> int b;
> };
>
> }
>
> but since this is a c struct then why could i create an object of the
> type like this anything a;
> C doesn't allow this.
Don't think of it as an object."anything" is a C struct, not a class. So
you use like a C struct. This line will fail to compile:
---
anything a;
---
because there's no type "anything". But there IS a type "struct
anything", so you can use:
---
struct anything a;
---
to create a variable of this type ("struct anything"). If you don't want
to write "struct anything", you have to declare your struct like this:
---
typedef struct
{
int a;
int b;
}anything;
---
Now you can just write "anything a;", as "anything" is now a new type.
My recomendation: try not to mix C and C++ when you are learning one of
them; learn them as independent languages (if you learned C++ first,
don't skip the C introduction, or you will only get confused about the
details; the same applies to learning C first and then C++).
Daniel K. O.
|
|
From: Noorez K. <coo...@ho...> - 2004-08-24 01:07:15
|
I tried this for a test
extern "C"
{
struct anything
{
int a;
int b;
};
}
but since this is a c struct then why could i create an object of the type
like this anything a;
C doesn't allow this.
_________________________________________________________________
Take advantage of powerful junk e-mail filters built on patented Microsoft®
SmartScreen Technology.
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
Start enjoying all the benefits of MSN® Premium right now and get the
first two months FREE*.
|
|
From: <or...@vp...> - 2004-08-23 21:13:15
|
Noorez Kassam wrote: > The compiler that I am using doesn't seem to put in the _cplusplus. I=20 > discovered this when I tried to use it with the preprosser. >=20 > #ifdef _cplusplus > extern "C" <something> > #endif Use __cplusplus -- Greetings, Bal=E1zs |
|
From: Scott S. <age...@co...> - 2004-08-23 21:11:42
|
It should be this:
#ifdef __cplusplus //2 underscores
extern "C" {
...
#endif
You only put in 1 underscore
Noorez Kassam wrote:
> The compiler that I am using doesn't seem to put in the _cplusplus. I
> discovered this when I tried to use it with the preprosser.
>
> #ifdef _cplusplus
> extern "C" <something>
> #endif
>
> _________________________________________________________________
> Take charge with a pop-up guard built on patented Microsoft®
> SmartScreen Technology.
> http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
> Start enjoying all the benefits of MSN® Premium right now and get the
> first two months FREE*.
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Noorez K. <coo...@ho...> - 2004-08-23 19:47:32
|
The compiler that I am using doesn't seem to put in the _cplusplus. I discovered this when I tried to use it with the preprosser. #ifdef _cplusplus extern "C" <something> #endif _________________________________________________________________ Take charge with a pop-up guard built on patented Microsoft® SmartScreen Technology. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. |