dev-cpp-users Mailing List for Dev-C++ (Page 654)
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...@ya...> - 2001-10-26 10:59:53
|
At first the results of your code to my pc (piii 1000 MHz, 512 MB RAM):
=20
Time spent for memset(): 200
Time spent for the for loop: 350
=20
strcat() needed: 290
Our manual strcat character by character thing needed: 340
=20
The size of our string was: 63999992
strlen() needed to measure the string length: 481
The time we needed to measure the length of the string: 340
=20
=20
I hadn't thought that the compiler excludes the call and assignment of
i=3Dstrlen() because it notices we do not use i (clever indeed). But =
the
rest shows clearly that memset() is not using character by character
assignment to assign values and strcat is not looking character after
character too (perhaps they use an int pointer and make tricks,
something i just thought but not character after character).=20
=20
=20
It seems that we will never end arguing on details. I disagree with your
comment:
=20
/* When using increment or decrement operators you should use the pre
form
rather than the post form as it is more efficient. Only post
increment or
decrement when you need the value before the change.
Also pointer arithmetic is faster than array indexing. */
=20
=20
This is truth *only* if we use overloaded post increment and decrement
operators for our objects and not for built in types. This thing reminds
me something i read on the web from a Schildt book, i will not tell you
about Schildt, check www.accu.org at the book reviews and read the
reviews of his books.=20
Also pointer arithmetic and array indexing is exactly the same and
compiler translates them the same. So this is definately wrong too. :)
=20
=20
I changed the color so as to find quickly my disagreements. :)
=20
=20
=20
Ioannis
=20
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
<http://www.noicys.f2s.com/>=20
* Alternative URL: http://run.to/noicys
=20
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Jason
Hardman
Sent: Friday, October 26, 2001 3:31 AM
To: Dev-C++
Subject: Re: [Dev-C++] Errorhandling
I'm sure you want this over and done with, but I decided to look at your
code and I have optimised some of it, and corrected an error that cause
a miss read of the time taken for strlen(). I hadn't realised this, but
when you are assigning a variable a value you don't use the compiler
happily ignores the value and doesn't bother with the assignment. What
that meant was it didn't actualy execute the strlen function in your
version, hence no time taken. I hadn't known this before, but it's quite
clever.
=20
I also did some other optimisations, I note that strcat() is still
slightly faster than our own version, but not by a massive margin. I'm
not absolutley sure that the tests are equal, but they seem to be
representative. I find it funny that my "memset" is faster than the real
one, so maybe there's an error or unaccounted optimisation somewhere?
=20
Note that I did the test using full compiler optimisations, as that
would be representative of a real world test. Also note that I decreased
SIZE, because I have only 128MB on my machine and using a 100 million
bytes forces windows to use virtual memory, which will cause large
slowdown, and prevent accurate figures.
=20
I was tempted to rewrite it all into a style I would normally use, but
couldn't be bothered. :-D
=20
Regards, Jason.
----- Original Message -----=20
From: Ioannis Vranos <mailto:no...@ya...> =20
To: Dev-C++ <mailto:dev...@li...> =20
Sent: Friday, October 26, 2001 1:02 AM
Subject: RE: [Dev-C++] Errorhandling
Ok, we all agree that it is working like that but i am probably right on
this (as you were right for some other details in things i had not
noticed before).
=20
But my last effort to persuade you is attached in this email as file
temp.c . It is ANSI C code and it shows the differences between the
performance of standard library functions and character by character
things. Please take a look and execute the code.
=20
=20
The results to my machine:
=20
C:\c>temp
Time spent for memset(): 300
Time spent for the for loop: 471
=20
strcat() needed: 461
Our manual strcat character by character thing needed: 571
=20
strlen() needed to measure the string length: 0
The time we needed to measure the length of the string: 560
=20
=20
Notice especially the last.
=20
=20
Friendly,
Ioannis
=20
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
<http://www.noicys.f2s.com/>=20
* Alternative URL: http://run.to/noicys
=20
=20
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Jason
Hardman
Sent: Friday, October 26, 2001 12:05 AM
To: Dev-C++
Subject: Re: [Dev-C++] Errorhandling
You cannot always know the length of an array or string at compile time.
It is possible for things like array size and such to be determined at
compile-time and at run-time (depending), but by doing it at run-time
you are incurring an overhead in your code, which isn't part of the C
style of programming. Adding these mechanisms to C code with hidden
compiler features would be breaking the general C/C++ ethic, at least in
my view.
=20
The only reason I'm 'discussing' this is because the more I think about
it the more I come to believe that it's more likely that standard
functions like strcat() and strlen() will determine the length of the
string by going all the way through the string until null. I know this
is an old argument, but I find it difficult to believe that it would be
done a different way. C doesn't actualy have native support for strings,
it just uses an array of chars, and allows the definition of string
literals.
=20
In Pascal, for example, it does have native support for strings and you
will find that it will store a pointer to an array and the first element
of the array will be the length of the string that follows.
=20
If you want we can end this particular argument and settle on the fact
that we are both willing to differ in opinion, and that it doesn't
matter which is true 'cos it still works no matter what.
=20
Jason.
|
|
From: Jason H. <jas...@bt...> - 2001-10-26 03:33:17
|
I'm always glad to help, and it's nice to hear a "thank you" now and again.
:)
Jason.
----- Original Message -----
From: "Marton Rusk" <mar...@ho...>
To: <jas...@bt...>
Sent: Friday, October 26, 2001 4:21 AM
Subject: Re: [Dev-C++] newbie needs help
> WOW, yippeee! that fixed it, thank you! I been banging my head against the
> keyboard half the day trying to figure this out. I "thought" i put it
inside
> of main but i guess i didn't try it.
>
> Thank you!
>
> Marton D. Rusk
>
>
> >From: "Jason Hardman" <jas...@bt...>
> >To: "Dev-C++" <dev...@li...>
> >Subject: Re: [Dev-C++] newbie needs help
> >Date: Fri, 26 Oct 2001 04:09:25 +0100
> >
> >The commented code should be inside the main function, between the two
{}.
> >Also you need to qualify the scope of the flags in the first, so:
> >
> >cout << ios::fixed << ios::showpoint;
> >
> >Which will compile in Dev-C++, although I have noticed it outputs a weird
> >number, but I'll let you sort that out.
> >
> >The second commented code works fine (assuming you put it inside main()).
> >
> >The last won't work, but it's not needed as you should use ios:: and not
> >ios_base::
> >
> >I've attached some code for you to work with.
> >
> >Jason.
> >
> >----- Original Message -----
> >From: "Marton Rusk" <mar...@ho...>
> >To: <dev...@li...>
> >Sent: Friday, October 26, 2001 3:46 AM
> >Subject: [Dev-C++] newbie needs help
> >
> >
> > > Hello all,
> > >
> > > I'm a programming student currently in my C++ part 2 class.
> > >
> > > Please tell me why the following code gives me errors with any of the
> >three
> > > commented floating point formatting code un-commented? I get errors
with
> > > three different compilers.
> > >
> > > If anyone knows how to fix this please help. Or, if anyone knows
another
> >way
> > > to format floating point data please help.
> > >
> > > Thanks,
> > >
> > > Marton D. Rusk
> > >
> > >
> > > #include <iostream>
> > > #include <iomanip>
> > >
> > > using namespace std;
> > >
> > > //cout << fixed << showpoint; //don't work
> > >
> > > //cout.setf(ios::fixed, ios::floatfield); //don't work
> > > //cout.setf(ios::showpoint);
> > >
> > > //cout.setf(ios_base::fixed, ios_base::floatfield); //don't work
> > > //cout.setf(ios_base::showpoint);
> > >
> > > int main(){
> > >
> > > float number = 3.57890;
> > >
> > > cout << number;
> > > return 0;
> > > }
> > >
> > >
> > > _________________________________________________________________
> > > Get your FREE download of MSN Explorer at
> >http://explorer.msn.com/intl.asp
> > >
> > >
> > > _______________________________________________
> > > Dev-cpp-users mailing list
> > > Dev...@li...
> > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> ><< iomanipstuff.cpp >>
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
|
|
From: Jason H. <jas...@bt...> - 2001-10-26 03:09:42
|
The commented code should be inside the main function, between the two {}.
Also you need to qualify the scope of the flags in the first, so:
cout << ios::fixed << ios::showpoint;
Which will compile in Dev-C++, although I have noticed it outputs a weird
number, but I'll let you sort that out.
The second commented code works fine (assuming you put it inside main()).
The last won't work, but it's not needed as you should use ios:: and not
ios_base::
I've attached some code for you to work with.
Jason.
----- Original Message -----
From: "Marton Rusk" <mar...@ho...>
To: <dev...@li...>
Sent: Friday, October 26, 2001 3:46 AM
Subject: [Dev-C++] newbie needs help
> Hello all,
>
> I'm a programming student currently in my C++ part 2 class.
>
> Please tell me why the following code gives me errors with any of the
three
> commented floating point formatting code un-commented? I get errors with
> three different compilers.
>
> If anyone knows how to fix this please help. Or, if anyone knows another
way
> to format floating point data please help.
>
> Thanks,
>
> Marton D. Rusk
>
>
> #include <iostream>
> #include <iomanip>
>
> using namespace std;
>
> //cout << fixed << showpoint; //don't work
>
> //cout.setf(ios::fixed, ios::floatfield); //don't work
> //cout.setf(ios::showpoint);
>
> //cout.setf(ios_base::fixed, ios_base::floatfield); //don't work
> //cout.setf(ios_base::showpoint);
>
> int main(){
>
> float number = 3.57890;
>
> cout << number;
> return 0;
> }
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: Marton R. <mar...@ho...> - 2001-10-26 02:46:26
|
Hello all,
I'm a programming student currently in my C++ part 2 class.
Please tell me why the following code gives me errors with any of the three
commented floating point formatting code un-commented? I get errors with
three different compilers.
If anyone knows how to fix this please help. Or, if anyone knows another way
to format floating point data please help.
Thanks,
Marton D. Rusk
#include <iostream>
#include <iomanip>
using namespace std;
//cout << fixed << showpoint; //don't work
//cout.setf(ios::fixed, ios::floatfield); //don't work
//cout.setf(ios::showpoint);
//cout.setf(ios_base::fixed, ios_base::floatfield); //don't work
//cout.setf(ios_base::showpoint);
int main(){
float number = 3.57890;
cout << number;
return 0;
}
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
|
|
From: Marton R. <mar...@ho...> - 2001-10-26 02:37:43
|
Hello all,
I'm a programming student currently in my C++ part 2 class.
Please tell me why the following code gives me errors with any of the three
commented floating point formatting code un-commented? I get errors with
three different compilers.
If anyone knows how to fix this please help. Or, if anyone knows another way
to format floating point data please help.
Thanks,
Marton D. Rusk
#include <iostream>
#include <iomanip>
using namespace std;
//cout << fixed << showpoint; //don't work
//cout.setf(ios::fixed, ios::floatfield); //don't work
//cout.setf(ios::showpoint);
//cout.setf(ios_base::fixed, ios_base::floatfield); //don't work
//cout.setf(ios_base::showpoint);
int main(){
float number = 3.57890;
cout << number;
return 0;
}
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
|
|
From: Andreas S. <ex...@gm...> - 2001-10-26 00:09:49
|
Hello , -- Best regards, Andreas mailto:ex...@gm... |
|
From: Andreas S. <ex...@gm...> - 2001-10-26 00:05:08
|
hi dev-cpp-users, can anyone tell me, where i can find a manual describing all the libraries included in devc like memory.h, winsock.h, dos.h -- MFG Andreas Sauer mailto:ex...@gm... |
|
From: Jason H. <jas...@bt...> - 2001-10-25 22:05:40
|
MessageYou cannot always know the length of an array or string at = compile time. It is possible for things like array size and such to be = determined at compile-time and at run-time (depending), but by doing it = at run-time you are incurring an overhead in your code, which isn't part = of the C style of programming. Adding these mechanisms to C code with = hidden compiler features would be breaking the general C/C++ ethic, at = least in my view. The only reason I'm 'discussing' this is because the more I think about = it the more I come to believe that it's more likely that standard = functions like strcat() and strlen() will determine the length of the = string by going all the way through the string until null. I know this = is an old argument, but I find it difficult to believe that it would be = done a different way. C doesn't actualy have native support for strings, = it just uses an array of chars, and allows the definition of string = literals. In Pascal, for example, it does have native support for strings and you = will find that it will store a pointer to an array and the first element = of the array will be the length of the string that follows. If you want we can end this particular argument and settle on the fact = that we are both willing to differ in opinion, and that it doesn't = matter which is true 'cos it still works no matter what. Jason. ----- Original Message -----=20 From: Ioannis Vranos=20 To: Dev-C++=20 Sent: Thursday, October 25, 2001 10:54 PM Subject: RE: [Dev-C++] Errorhandling Isn't it possible for an internal "sizeof style" mechanism that = determines the size of the data and insert it as a constant value in any = function, at a specific system? Btw for what about are we arguing for? (If we are arguing) :) Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... = [mailto:dev...@li...] On Behalf Of Jason = Hardman Sent: Thursday, October 25, 2001 4:13 PM To: Dev-C++ Subject: Re: [Dev-C++] Errorhandling > As a hint take for example > sizeof. sizeof even for ANSI standard knows the length of an array = in > the scope it was defined. How does it know? It's compiler stuff = and > compiler knows. So strcat() to search character after character = would be > stupid for a nowadays compiler. But it is *safe* to assume it = looks > character after character to find the '\0'. It's important to realise that sizeof is a special compile time = operator. When the compiler finds it it determines the size of the data = refered to and inserts it as a constant value. The sizeof operator won't = work at runtime. For it to work at runtime the compiler would have to = include a lot of extra code and information about a data type created to = help detemine sizes, and that wouldn't follow the standard AFAICT. To do = that would turn C/C++ into a higher level "safe" language that is also a = lot slower. So what does strcat() or strlen() do when you pass it a = dynamically allocated array that the compiler didn't know about at = compile-time? It won't use the sizeof. =20 > unsigned char str[] =3D {'\200', '\250', '\210', '\300', '\0'}; >=20 > I've not looked up what those numbers do, but generally there=20 > are additional characters after 127 decimal (177 octal) that=20 > are special, i.e. graphics characters. I remind you that a=20 > backslash followed by a number is an octal number and not a = decimal. > A number having a \ is an escape sequence, *not* an octal number. = 0200 > is an octal number (without ' '). I was refering to the fact that the number following the backslash = is interpreted as an octal constant and not as a decimal; it doesn't = need the preceding zero. Also if you write '\xff', that is a hexadecimal = character constant. Regards, Jason. |
|
From: Elias P. <eli...@ao...> - 2001-10-25 21:32:54
|
> I am having some trouble with compiling Allegro. Has anyone succeeded with > this recently? Please post the steps you took to get it working. There should be an extra section about dev-c++ in the readme.mgw file, IIRC. Else, you might find this useful: http://www.allegro.cc/ubb-bin/ultimatebb.cgi?ubb=get_topic&f=10&t=000083 -- Elias Pschernig |
|
From: Christiaan S. <ck...@ia...> - 2001-10-25 21:22:29
|
Ok Ive downloaded all these files: gl.h glu.h glaux.h now how do i tell the compiler to use them? where should i copy them = to? |
|
From: jansb000 <jan...@wx...> - 2001-10-25 21:22:10
|
I am having some trouble with compiling Allegro. Has anyone succeeded with this recently? Please post the steps you took to get it working. |
|
From: Ioannis V. <no...@ya...> - 2001-10-25 21:03:11
|
About '\some_number' and octal, you are right i checked so i recall the last C style code. :) =20 About the rest concerning compiler implementation and system dependend (and some times in another language) code i insist. :) =20 =20 Ioannis =20 * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com <http://www.noicys.f2s.com/>=20 * Alternative URL: http://run.to/noicys =20 -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Jason Hardman Sent: Thursday, October 25, 2001 4:13 PM To: Dev-C++ Subject: Re: [Dev-C++] Errorhandling > As a hint take for example > sizeof. sizeof even for ANSI standard knows the length of an array in > the scope it was defined. How does it know? It's compiler stuff and > compiler knows. So strcat() to search character after character would be > stupid for a nowadays compiler. But it is *safe* to assume it looks > character after character to find the '\0'. =20 It's important to realise that sizeof is a special compile time operator. When the compiler finds it it determines the size of the data refered to and inserts it as a constant value. The sizeof operator won't work at runtime. For it to work at runtime the compiler would have to include a lot of extra code and information about a data type created to help detemine sizes, and that wouldn't follow the standard AFAICT. To do that would turn C/C++ into a higher level "safe" language that is also a lot slower. So what does strcat() or strlen() do when you pass it a dynamically allocated array that the compiler didn't know about at compile-time? It won't use the sizeof. =20 =20 > unsigned char str[] =3D {'\200', '\250', '\210', '\300', '\0'}; >=20 > I've not looked up what those numbers do, but generally there=20 > are additional characters after 127 decimal (177 octal) that=20 > are special, i.e. graphics characters. I remind you that a=20 > backslash followed by a number is an octal number and not a decimal. > A number having a \ is an escape sequence, *not* an octal number. 0200 > is an octal number (without ' '). =20 I was refering to the fact that the number following the backslash is interpreted as an octal constant and not as a decimal; it doesn't need the preceding zero. Also if you write '\xff', that is a hexadecimal character constant. =20 Regards, Jason. |
|
From: Ioannis V. <no...@ya...> - 2001-10-25 20:52:34
|
Isn't it possible for an internal "sizeof style" mechanism that
determines the size of the data and insert it as a constant value in any
function, at a specific system?
=20
=20
For the rest check the following C++ code:
=20
#include <cstdio>
=20
int main()
{
using namespace std;
=20
printf("%d %u\n\n", '\200', '\200');
printf("%d %u\n", 0200, 0200);
}
=20
=20
Btw for what about are we arguing for? (If we are arguing) :)
=20
=20
Ioannis
=20
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
<http://www.noicys.f2s.com/>=20
* Alternative URL: http://run.to/noicys
=20
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Jason
Hardman
Sent: Thursday, October 25, 2001 4:13 PM
To: Dev-C++
Subject: Re: [Dev-C++] Errorhandling
> As a hint take for example
> sizeof. sizeof even for ANSI standard knows the length of an array in
> the scope it was defined. How does it know? It's compiler stuff and
> compiler knows. So strcat() to search character after character would
be
> stupid for a nowadays compiler. But it is *safe* to assume it looks
> character after character to find the '\0'.
=20
It's important to realise that sizeof is a special compile time
operator. When the compiler finds it it determines the size of the data
refered to and inserts it as a constant value. The sizeof operator won't
work at runtime. For it to work at runtime the compiler would have to
include a lot of extra code and information about a data type created to
help detemine sizes, and that wouldn't follow the standard AFAICT. To do
that would turn C/C++ into a higher level "safe" language that is also a
lot slower. So what does strcat() or strlen() do when you pass it a
dynamically allocated array that the compiler didn't know about at
compile-time? It won't use the sizeof. =20
=20
> unsigned char str[] =3D {'\200', '\250', '\210', '\300', '\0'};
>=20
> I've not looked up what those numbers do, but generally there=20
> are additional characters after 127 decimal (177 octal) that=20
> are special, i.e. graphics characters. I remind you that a=20
> backslash followed by a number is an octal number and not a decimal.
> A number having a \ is an escape sequence, *not* an octal number. 0200
> is an octal number (without ' ').
=20
I was refering to the fact that the number following the backslash is
interpreted as an octal constant and not as a decimal; it doesn't need
the preceding zero. Also if you write '\xff', that is a hexadecimal
character constant.
=20
Regards, Jason.
|
|
From: Christiaan S. <ck...@ia...> - 2001-10-25 20:52:20
|
Im following a tutorial on opengl and when i try to compile the code I = get errors. I think its becuase it cant find these header files: #include <windows.h> #include <gl\gl.h> #include <gl\glu.h> #include <gl\glaux.h> Does dev-c++ have these files? Is there anything else i need to know = before i start making opengl apps? |
|
From: Jason H. <jas...@bt...> - 2001-10-25 14:13:52
|
> As a hint take for example
> sizeof. sizeof even for ANSI standard knows the length of an array in
> the scope it was defined. How does it know? It's compiler stuff and
> compiler knows. So strcat() to search character after character would =
be
> stupid for a nowadays compiler. But it is *safe* to assume it looks
> character after character to find the '\0'.
It's important to realise that sizeof is a special compile time =
operator. When the compiler finds it it determines the size of the data =
refered to and inserts it as a constant value. The sizeof operator won't =
work at runtime. For it to work at runtime the compiler would have to =
include a lot of extra code and information about a data type created to =
help detemine sizes, and that wouldn't follow the standard AFAICT. To do =
that would turn C/C++ into a higher level "safe" language that is also a =
lot slower. So what does strcat() or strlen() do when you pass it a =
dynamically allocated array that the compiler didn't know about at =
compile-time? It won't use the sizeof.
=20
> unsigned char str[] =3D {'\200', '\250', '\210', '\300', '\0'};
>=20
> I've not looked up what those numbers do, but generally there=20
> are additional characters after 127 decimal (177 octal) that=20
> are special, i.e. graphics characters. I remind you that a=20
> backslash followed by a number is an octal number and not a decimal.
> A number having a \ is an escape sequence, *not* an octal number. 0200
> is an octal number (without ' ').
I was refering to the fact that the number following the backslash is =
interpreted as an octal constant and not as a decimal; it doesn't need =
the preceding zero. Also if you write '\xff', that is a hexadecimal =
character constant.
Regards, Jason.
|
|
From: Ioannis V. <no...@ya...> - 2001-10-25 11:07:49
|
> -----Original Message-----
> From: dev...@li...=20
> [mailto:dev...@li...] On Behalf=20
> Of Jason Hardman
> Sent: Wednesday, October 24, 2001 11:59 PM
> To: Dev-C++
> Subject: Re: [Dev-C++] Errorhandling
>=20
>=20
> While I don't want to kick up a fuss in this discussion I=20
> would like to point out firstly that search techniques in=20
> general rely on the structure to be searched being sorted=20
> into some specific order. It would be unreasonable to sort a=20
> string just so you can find the instance of a null, and it=20
> would invalidate the result anyway. ;) There isn't much more=20
> you can do in searching a string except by going in sequence=20
> through it. I know it has been mentioned that maybe a=20
You are talking about ANSI C way. But compiler stuff can be written in a
system dependend and more close to the machine way, so it can use win32
for example. It can use assembly, and generally the compiler knows
*more* than us from outside the compiler. As a hint take for example
sizeof. sizeof even for ANSI standard knows the length of an array in
the scope it was defined. How does it know? It's compiler stuff and
compiler knows. So strcat() to search character after character would be
stupid for a nowadays compiler. But it is *safe* to assume it looks
character after character to find the '\0'. As it is safe to assume it
is written in C doing that, but of course it can be written in whatever
language the compiler author wants (assembly, C++, ...). Usually C and
C++ are the case but it could be even fortran for some special cases
(precompiled the implementation file).
> compiler has optimisations to work around searching the=20
> entire length of a string to find it's end, but it's not=20
> something you can rely on. Adding these features would=20
> introduce a great deal of complexity into the compiler, but=20
> that is up to whoever writes it. I think you will find that=20
> the majority of compilers will actualy deal with string=20
> operations in the way you would expect from an external=20
> viewpoint. You will note that that standard C/C++ does not=20
Yes that's what i said.
> rely on knowing the lengths of arrays and will overrun their=20
ANSI C/C++ know the length of the arrays in the scope they were declared
using sizeof.
> ends if you are not careful. I would think that if the
> compiler had extra info about a string like it's length then=20
> it would use it in cases like this. In the end it's not=20
Yes it probably does.
> something I have to worry about.
I agree very much. :)
> Secondly, the use of the '\0' character is fairly limited,=20
> but there are some cases where it may be used. I agree that=20
> using it to manualy null terminate a string literal is bad=20
> practice and should be avoided.
>=20
> Possibilities for use of '\0' are:
>=20
> Manualy null terminating a string, i.e.
>=20
> char str[27];
> for(char i =3D 0; i < 26; ++i) str[i] =3D 'A' + i;
> str[26] =3D '\0';
> cout << str;
>=20
> Of course you could just as easily use a zero, but '\0' is in=20
> context to the operation this way.
Yes i agree but this is another case.
> or
>=20
> unsigned char str[] =3D {'\200', '\250', '\210', '\300', '\0'};
>=20
> I've not looked up what those numbers do, but generally there=20
> are additional characters after 127 decimal (177 octal) that=20
> are special, i.e. graphics characters. I remind you that a=20
> backslash followed by a number is an octal number and not a decimal.
A number having a \ is an escape sequence, *not* an octal number. 0200
is an octal number (without ' ').
=20
> Also I could envisage using it within a string literal as a=20
> way of breaking it up i.e. "Hello.\0This is a test.\0Break!",=20
Yes, but this is another case.
> of course I wouldn't recomend using a structure like this=20
> generally, but it's not impossible to envision a need for it.=20
> You would have to parse it manualy to obtain the strings or=20
> other data from it.
>=20
> Just some thoughts, Jason.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
* Alternative URL: http://run.to/noicys
|
|
From: Edwin D. <edw...@ya...> - 2001-10-25 02:12:41
|
hello all, I want to use wxWindows with DevC++. Can anybody tell me how to make it work. How do I start?Is there additional tools that I need?Will I be able to write GUI application visually? Thanks, Edwin __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com |
|
From: <jd...@da...> - 2001-10-24 23:15:37
|
Hi, somebody could explain how create a Dll Project with Dev-C++? I'm not able to do it. Or maybe somebody could suggest me a tutorial... I'm italian and my english is quite bad... |
|
From: Jason H. <jas...@bt...> - 2001-10-24 21:59:08
|
While I don't want to kick up a fuss in this discussion I would like to
point out firstly that search techniques in general rely on the structure to
be searched being sorted into some specific order. It would be unreasonable
to sort a string just so you can find the instance of a null, and it would
invalidate the result anyway. ;) There isn't much more you can do in
searching a string except by going in sequence through it. I know it has
been mentioned that maybe a compiler has optimisations to work around
searching the entire length of a string to find it's end, but it's not
something you can rely on. Adding these features would introduce a great
deal of complexity into the compiler, but that is up to whoever writes it. I
think you will find that the majority of compilers will actualy deal with
string operations in the way you would expect from an external viewpoint.
You will note that that standard C/C++ does not rely on knowing the lengths
of arrays and will overrun their ends if you are not careful. I would think
that if the compiler had extra info about a string like it's length then it
would use it in cases like this. In the end it's not something I have to
worry about.
Secondly, the use of the '\0' character is fairly limited, but there are
some cases where it may be used. I agree that using it to manualy null
terminate a string literal is bad practice and should be avoided.
Possibilities for use of '\0' are:
Manualy null terminating a string, i.e.
char str[27];
for(char i = 0; i < 26; ++i) str[i] = 'A' + i;
str[26] = '\0';
cout << str;
Of course you could just as easily use a zero, but '\0' is in context to the
operation this way.
or
unsigned char str[] = {'\200', '\250', '\210', '\300', '\0'};
I've not looked up what those numbers do, but generally there are additional
characters after 127 decimal (177 octal) that are special, i.e. graphics
characters. I remind you that a backslash followed by a number is an octal
number and not a decimal.
Also I could envisage using it within a string literal as a way of breaking
it up i.e. "Hello.\0This is a test.\0Break!", of course I wouldn't recomend
using a structure like this generally, but it's not impossible to envision a
need for it. You would have to parse it manualy to obtain the strings or
other data from it.
Just some thoughts, Jason.
----- Original Message -----
From: "Ioannis Vranos" <no...@ya...>
To: "Dev-C++" <dev...@li...>
Sent: Wednesday, October 24, 2001 10:48 PM
Subject: RE: [Dev-C++] Errorhandling
> -----Original Message-----
> From: Juliet [mailto:no...@li...]
> Sent: Wednesday, October 24, 2001 9:15 PM
> To: Ioannis Vranos
> Subject: RE: [Dev-C++] Errorhandling
>
>
> At 11.47 23/10/2001 +0200, you wrote:
> >Uf. I do not want to open issues here, but there are many searching
> >algorithms (which i do not know). One efficient the C
> library provides is
> >bsearch().
>
> That would be overkill in this case :) Think about it, what
> does strcat do?
> it finds the end of the first string, then starts copying the
> second string
> into it, until that string ends too. You'd be right if the
> EOS wasn't a
> single character but rather some character sequence, hopefully the C
> designers weren't that stupid :)
I am not talking about strcat(). I am talking in general stating that
"string\0" only bad things can cause (except we need that particular
form and we know what we are doing). Because the person who writes
"string\0" doesn't seem to know that "string" has a '\0' automatically.
Anyway the implementation of strcat() would be enough stupid if it
searched character after character (even if it was written in C itself).
Many compiler operations are written in very much low level and system
dependent way so we can't know how exactly strcat() is written (with the
exception we have the source code). For example see 8.7 in K&R. Also see
header files of Dev-C++ to see Windows dependent declarations even
there. The only thing we know is that strcat() must replace the first
'\0' it finds so thinking of it looking character after character
doesn't cause any harm.
>
> >It can be written in assembly, pascal (as in C++ Builder)
> with a C type
> >interface, e.t.c..
>
> Generally a language's runtime is written in the same language, for
> essentially one reason: developers willing to learn from it
> and improve it
> won't need extra tools, compilers or knowledge of foreign
> languages. In
> particular, using ASM is the worst thing you could do
It is not necessary to have the source code of the implementation of the
library. It may come in precompiled form and only the header files with
the declarations to be supplied. It is also possible to not even have
any source files at all, and #include statements to work as switches as
i mentioned some day (but the #include mechanism *must* behave as if
there are source files and are included, the same it does with our
header files). So it is safe to always think that #include includes
header files even if this is not the case.
>
> You *need* ASM only to use features of the particular architecture
> (interrupts/traps, instructions implementing whole functions,
> native large
> integers, native floats, etc.), not covered by normal
> languages (exactly
> because of their specificity). The speed/optimization thing
> should be left
> to the compilers, and they do a pretty nice job. Couple them with
> binary-to-binary profiling compilers (these are something
> really cool!),
> and you will obtain something impossible to do by hand
I agree.
> For example: the part I hated most of the Delphi runtime (not
> the VCL,
> however. That's pure Object Pascal) was that it's about 50%
> ASM, not even
> inline assembly (heck, I wouldn't understand it, but at least I could
> *compile* it), I'm talking about macro-ASM files that need
> their commercial
> (100$ and being sold only in the US) assembler, Tasm32, to be built
Yes.
Also i hate pascal. :)
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
* Alternative URL: http://run.to/noicys
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: Ioannis V. <no...@ya...> - 2001-10-24 20:46:51
|
> -----Original Message----- > From: Juliet [mailto:no...@li...]=20 > Sent: Wednesday, October 24, 2001 9:15 PM > To: Ioannis Vranos > Subject: RE: [Dev-C++] Errorhandling >=20 >=20 > At 11.47 23/10/2001 +0200, you wrote: > >Uf. I do not want to open issues here, but there are many searching > >algorithms (which i do not know). One efficient the C=20 > library provides is=20 > >bsearch(). >=20 > That would be overkill in this case :) Think about it, what=20 > does strcat do?=20 > it finds the end of the first string, then starts copying the=20 > second string=20 > into it, until that string ends too. You'd be right if the=20 > EOS wasn't a=20 > single character but rather some character sequence, hopefully the C=20 > designers weren't that stupid :) I am not talking about strcat(). I am talking in general stating that "string\0" only bad things can cause (except we need that particular form and we know what we are doing). Because the person who writes "string\0" doesn't seem to know that "string" has a '\0' automatically. Anyway the implementation of strcat() would be enough stupid if it searched character after character (even if it was written in C itself). Many compiler operations are written in very much low level and system dependent way so we can't know how exactly strcat() is written (with the exception we have the source code). For example see 8.7 in K&R. Also see header files of Dev-C++ to see Windows dependent declarations even there. The only thing we know is that strcat() must replace the first '\0' it finds so thinking of it looking character after character doesn't cause any harm. >=20 > >It can be written in assembly, pascal (as in C++ Builder)=20 > with a C type > >interface, e.t.c.. >=20 > Generally a language's runtime is written in the same language, for=20 > essentially one reason: developers willing to learn from it=20 > and improve it=20 > won't need extra tools, compilers or knowledge of foreign=20 > languages. In=20 > particular, using ASM is the worst thing you could do It is not necessary to have the source code of the implementation of the library. It may come in precompiled form and only the header files with the declarations to be supplied. It is also possible to not even have any source files at all, and #include statements to work as switches as i mentioned some day (but the #include mechanism *must* behave as if there are source files and are included, the same it does with our header files). So it is safe to always think that #include includes header files even if this is not the case. >=20 > You *need* ASM only to use features of the particular architecture=20 > (interrupts/traps, instructions implementing whole functions,=20 > native large=20 > integers, native floats, etc.), not covered by normal=20 > languages (exactly=20 > because of their specificity). The speed/optimization thing=20 > should be left=20 > to the compilers, and they do a pretty nice job. Couple them with=20 > binary-to-binary profiling compilers (these are something=20 > really cool!),=20 > and you will obtain something impossible to do by hand I agree. =20 > For example: the part I hated most of the Delphi runtime (not=20 > the VCL,=20 > however. That's pure Object Pascal) was that it's about 50%=20 > ASM, not even=20 > inline assembly (heck, I wouldn't understand it, but at least I could=20 > *compile* it), I'm talking about macro-ASM files that need=20 > their commercial=20 > (100$ and being sold only in the US) assembler, Tasm32, to be built Yes. Also i hate pascal. :) Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys =20 |
|
From: Jason H. <jas...@bt...> - 2001-10-24 00:16:23
|
Hi Vatay.
You forgot the typedefs in the header:
typedef counter<int> int_counter;
typedef counter<float> float_counter;
Hope this helps. The code you were using was actualy creating instances of
objects in the header, which is very bad.
Toodle-pip, Jason. ;)
----- Original Message -----
From: "Vatay" <va...@op...>
To: <dev...@li...>
Sent: Tuesday, October 23, 2001 1:31 PM
Subject: [Dev-C++] Parametric polymorfizm
Hi,
I have one litle problem, to this time only C projects written and slowly
become familiar with polimorfizm and here is my problem:
I can't asking my friends (all programmed in Delphi).
A have one litte example written and the compiler returned 7 errors!
what have I wrong written?
Thank,
Szeg,ny Leg,ny
Error message:
c:/devcpp/paramtr/main.cpp: In function `int main()':
c:/devcpp/paramtr/main.cpp:11: `int_count' undeclared (first use this
function)
c:/devcpp/paramtr/main.cpp:11: (Each undeclared identifier is reported only
once
c:/devcpp/paramtr/main.cpp:11: for each function it appears in.)
c:/devcpp/paramtr/main.cpp:11: parse error before `;'
c:/devcpp/paramtr/main.cpp:12: `float_counter' undeclared (first use this
function)
c:/devcpp/paramtr/main.cpp:14: `c1' undeclared (first use this function)
c:/devcpp/paramtr/main.cpp:15: `c2' undeclared (first use this function)
Sorce code's:
// FILE: main.cpp
//
// SNIP: parametrikus polimorfizmus
#include <stdio.h>
#include "count.h"
main()
{
int_count c1;
float_counter c2;
c1.put_value(5);
c2.put_value(5.5);
printf("\n c1 = %d", c1.access_value() );
printf("\n c2 = %f", c2.access_value() );
}
// FILE: count.h
template <class T> class counter
{
private:
T value;
public:
counter () { value = 0; }
void increment() { value++; }
void decrement() { if(value > 0) value--; }
T access_value() { return value; }
void put_value( T new_value) { value = new_value; }
};
typedef counter<int> int_counter;
typedef counter<float> float_counter;
----------------- Live long OPREA & the Net
This e-mail has been sent with OperaMail, as a free service from
Opera Software.
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: jansb000 <jan...@wx...> - 2001-10-23 21:00:30
|
Yep, just try this program:
#include <stdio.h>
int main() {
printf("%d", sizeof(int));
}
For a more complete version of this program look at:
http://wcs-jabe.sourceforge.net/source/html/global_8h-source.html
http://wcs-jabe.sourceforge.net/source/html/globmain_8cpp-source.html
This is a program that I wrote to test the size of variables on =
different platforms (C++).
As far as I know an int is always the size that can be handled most =
easily by the CPU but minimal 16 bits. So, on the new Intel processor (I =
believe its the MERCAD) an int may be 64 bits since it is a 64-bit CPU. =
Some super computers also have 64-bit ints.
If you write cross-platform code then you should use 16-bit for integer =
(as an assumption), but you can never count on it that it will occupy =
just 2 bytes of memory.
----- Original Message -----=20
From: Daniel Glenfield=20
To: jan...@wx...=20
Sent: Friday, October 19, 2001 9:06 PM
Subject: Re: [Dev-C++] Unsigned and signed
that's it, knew I had the first 2 numbers right.
so you're telling me that a 32-bit machine can hold even greater =
values for int ? great, that's something my course never told me!
>From: "jansb000"=20
>To: "Daniel Glenfield"=20
>Subject: Re: [Dev-C++] Unsigned and signed=20
>Date: Fri, 19 Oct 2001 21:03:21 +0200=20
>=20
>You mean its -32768 to +32767 for signed and +65535 for unsigned.=20
>However that is only for 16-bit numbers. In DevC++/MingW32 an integer =
is by default 32-bit. On other machines it may be even 64-bit.=20
> ----- Original Message -----=20
> From: Daniel Glenfield=20
> To: dev...@li...=20
> Sent: Friday, October 19, 2001 5:08 PM=20
> Subject: RE: [Dev-C++] Unsigned and signed=20
>=20
>=20
> int holds any number from -32,332 to +32,332 (not sure about last 3 =
digits in each)=20
>=20
> and an unsigned int holds +64, 664 (again not sure about last 3)=20
>=20
>=20
>=20
> >From: "Ioannis Vranos"=20
> >To: "Dev-C++"=20
> >Subject: RE: [Dev-C++] Unsigned and signed=20
> >Date: Fri, 19 Oct 2001 17:54:32 +0200=20
> >=20
> >signed integer variables can store both positive and negative =
variables,=20
> >unsigned only positive.=20
> >=20
> >e.g.=20
> >int x;=20
> >signed int x; // They are both the same=20
> >=20
> >unsigned int x;=20
> >=20
> >long y;=20
> >signed long y; // They are both the same=20
> >=20
> >unsigned long y;=20
> >=20
> >=20
> >In the case of int the "int" can be avoided:=20
> >=20
> >int x;=20
> >signed x; // They are both the same=20
> >=20
> >unsigned x;=20
> >=20
> >=20
> >Also normally we do not use signed but only unsigned when we need =
so:=20
> >=20
> >int x; // signed=20
> >long y; //signed=20
> >=20
> >unsigned z; // unsigned int=20
> >unsigned long y;=20
> >unsigned char c;=20
> >=20
> >But a char it can be signed or unsigned. It depends from the =
system.=20
> >=20
> >E.g. char c; // it can be signed or unsigned=20
> >=20
> >signed char c; // signed=20
> >unsigned char c; // unsigned=20
> >=20
> >=20
> >Ioannis=20
> >=20
> >* Ioannis Vranos=20
> >* Programming pages: http://www.noicys.f2s.com=20
> >* Alternative URL: http://run.to/noicys=20
> >=20
> >=20
> >=20
> >=20
> > > -----Original Message-----=20
> > > From: dev...@li...=20
> > > [mailto:dev...@li...] On Behalf=20
> > > Of mi...@ju...=20
> > > Sent: Friday, October 19, 2001 1:36 PM=20
> > > To: dev...@li...=20
> > > Subject: [Dev-C++] Unsigned and signed=20
> > >=20
> > >=20
> > > What do unsigned and signed do to variables?=20
> > > ________________________________________________________________ =
> > > GET INTERNET ACCESS FROM JUNO!=20
> > > Juno offers FREE or PREMIUM Internet access for less!=20
> > > Join Juno today! For your FREE software, visit:=20
> > > http://dl.www.juno.com/get/web/.=20
> > >=20
> > >=20
> > > _______________________________________________=20
> > > Dev-cpp-users mailing list=20
> > > Dev...@li...=20
> > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users=20
> > >=20
> >=20
> >=20
> >_______________________________________________=20
> >Dev-cpp-users mailing list=20
> >Dev...@li...=20
> >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users=20
>=20
>=20
=
>------------------------------------------------------------------------=
------=20
> Get your FREE download of MSN Explorer at http://explorer.msn.com=20
> _______________________________________________ Dev-cpp-users =
mailing list Dev...@li... =
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users=20
-------------------------------------------------------------------------=
-----
Get your FREE download of MSN Explorer at http://explorer.msn.com
|
|
From: Timo K S. <tks...@cc...> - 2001-10-23 13:44:51
|
I have a large project, and Dev C++ does not like large projects. Does anyone know if it is possible to work around the second problem? I managed to get around the first one. - The project manager should be aware of the directory structure. I have a large project, and the source is distributed to several subdirectories. While Dev C++ currently allows me to add files from multiple directories, it is not a good idea to use Dev C++ that way. Dev C++ puts all object files to a single directory, and if there are several files with same name, some object files get overwritten, and I get undefined symbols. The project manager should create a copy of the source directory structure and place object files in the correct copy of the source directory. Also the project manager GUI should use treeview showing the directory structure instead of the current listview. And when I add files to project, I certainly do not want it to open each file. - The building process is way too simplified. Gcc links given object files from left to right and only picks those symbols which have been referenced so far. This means that if there is two-way dependencies, simply listing all object files to gcc does result undefined symbols. A hack to work around this would be to list all object files twice. But a complex source can have even more complex dependencies, and you may have to list the object files three or even more times. A better solution is to make a one big library from the object files just before linking to executable. Then use ranlib to create nice symboltable for the library, finally linking the library into executable with gcc. This works great for me - when I use gnu make manually and not Dev C++. I was able to work around the first problem, by making sure my project only had unique source filenames, but I think there is no way to make current Dev C++ to work around the second problem :/ There is an example of my current Makefile(.in) at.. http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/glelite/Teddy/src/Makefile.in?rev=HEAD&content-type=text/vnd.viewcvs-markup ..for example of use of ar and ranlib before executable linking. The project I'm working on is glelite.sf.net -- Timo Suoranta -- tks...@cc... -- |
|
From: Vatay <va...@op...> - 2001-10-23 12:39:25
|
Hi,
I have one litle problem, to this time only C projects written and slowly
become familiar with polimorfizm and here is my problem:
I can't asking my friends (all programmed in Delphi).
A have one litte example written and the compiler returned 7 errors!
what have I wrong written?
Thank,
Szeg=82ny Leg=82ny
Error message:
c:/devcpp/paramtr/main.cpp: In function `int main()':
c:/devcpp/paramtr/main.cpp:11: `int_count' undeclared (first use this
function)
c:/devcpp/paramtr/main.cpp:11: (Each undeclared identifier is reported only
once
c:/devcpp/paramtr/main.cpp:11: for each function it appears in.)
c:/devcpp/paramtr/main.cpp:11: parse error before `;'
c:/devcpp/paramtr/main.cpp:12: `float_counter' undeclared (first use this
function)
c:/devcpp/paramtr/main.cpp:14: `c1' undeclared (first use this function)
c:/devcpp/paramtr/main.cpp:15: `c2' undeclared (first use this function)
Sorce code's:
// FILE: main.cpp
//
// SNIP: parametrikus polimorfizmus
#include <stdio.h>
#include "count.h"
main()
{
int_count c1;
float_counter c2;
c1.put_value(5);
c2.put_value(5.5);
printf("\n c1 =3D %d", c1.access_value() );
printf("\n c2 =3D %f", c2.access_value() );
}
// FILE: count.h
template <class T> class counter
{
private:
T value;
public:
counter () { value =3D 0; }
void increment() { value++; }
void decrement() { if(value > 0) value--; }
T access_value() { return value; }
void put_value( T new_value) { value =3D new_value; }
};
counter<int> int_counter;
counter<float> float_counter;
----------------- Live long OPREA & the Net
This e-mail has been sent with OperaMail, as a free service from
Opera Software.
|
|
From: Ioannis V. <no...@ya...> - 2001-10-23 08:45:44
|
Uf. I do not want to open issues here, but there are many searching algorithms (which i do not know). One efficient the C library provides is bsearch(). Of course this particulal algorithm isn't applicable here, but the point is that any implementation can provide its own strcat() version. It can be written in assembly, pascal (as in C++ Builder) with a C type interface, e.t.c.. It is only guaranteed that it doesn't miss the first appearance of '\0'. Of course it can be written in C looking character after character. :) Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys > -----Original Message----- > From: Juliet [mailto:no...@li...]=20 > Sent: Monday, October 22, 2001 8:28 PM > To: Ioannis Vranos > Subject: RE: [Dev-C++] Errorhandling >=20 >=20 > At 00.54 21/10/2001 +0200, you wrote: > >That doesn't mean that strcat() searches character by=20 > character for 0=20 > >but > >it *behaves* as if it does that. >=20 > Post-scriptum to my previous message: well, it DOES. It's the=20 > only way to=20 > do it, you just have to write it in the most efficient way.=20 > Look at this=20 > (strcat.c, from ReactOS msvcrt implementation): >=20 > /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details=20 > */ #include <msvcrt/string.h> >=20 > char * > strcat(char *s, const char *append) > { > char *save =3D s; >=20 > for (; *s; ++s); > while ((*s++ =3D *append++)); > return save; > } >=20 |