dev-cpp-users Mailing List for Dev-C++ (Page 499)
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...> - 2002-10-25 13:15:47
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Per Westermark > Sent: Friday, October 25, 2002 1:54 PM > To: Ioannis Vranos > Cc: Dev-C++ Mailing List > Subject: RE: [Dev-C++] dynamic allocation and structs > > > Exactly why my previous mail specified use-cases. > > - Sparse matrix, where a lot of entries are NULL. > - Quick sort, since it's enough to move the pointers. As far as i can think of it, you can't use qsort() though. qsort() copies the elements and in addition, you can't compare pointers not pointing inside the same array. So you have to define your own facilities. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |
|
From: Ioannis V. <no...@ho...> - 2002-10-25 13:08:56
|
> -----Original Message----- > From: Per Westermark [mailto:pw...@ia...] > Sent: Friday, October 25, 2002 1:54 PM > To: Ioannis Vranos > Cc: Dev-C++ Mailing List > Subject: RE: [Dev-C++] dynamic allocation and structs > > > Exactly why my previous mail specified use-cases. > > - Sparse matrix, where a lot of entries are NULL. > - Quick sort, since it's enough to move the pointers. > - Different object types for each index, simulating C++ abstract base > class. You need void * for this (or a container struct). But this means you can't use it directly. > - Supports large vector in 16-bit code, where it's possible > to have 16000 > entries of up to 64000 byte size each. Yep, you are an older programmer than me. :) I know the 64 KB DOS limit though. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |
|
From: Per W. <pw...@ia...> - 2002-10-25 12:55:51
|
Since this is Dev-C++, i.e windows programing. The DLL is loaded in the memory space of your program. If multiple applications links to the same DLL, the DLL with "switch" between each applications memory space, depending on which application to make the call. The biggest problem with memory in a DLL is to have the DLL allocate C++ objects of new class types. You must export a static factory method, or global function for the allocation. There are a number of really good documents about this problem, but sorry, I don't have them accessible right now. /Per W On Fri, 25 Oct 2002, Abhijit Shylanath wrote: > Sorry if I'm converging, but I just found 2 cents in my hat... I remember > reading on the Allegro list that data alloc'ed in the Allegro DLL is not > accessible directly in the executable, so they use some fancy footwork to > manage all that. > > Isn't it unsafe to assume that the heap is shared across programs and > libraries? > > ___________________________________________________________ > > Abhijit Shylanath > > E-mail: mu...@gm... || ibr...@bi... > Web-site: http://mudeth.tripod.com/ > > > |
|
From: Per W. <pw...@ia...> - 2002-10-25 12:50:37
|
Milli is 1/1000, which is the standard quotient in the metric system. /Per W On Fri, 25 Oct 2002, Abhijit Shylanath wrote: > Greets, Wendel. > > > Hi, > > > > I'm trying do my program sleep from 25 to 40 min. I tryed use the funcion > > sleep() but i can't do it. :/ > > > > Someone know how to do it ?? Can gave-me a example ?? > > use Sleep(), declared in <windows.h> > > void Sleep(DWORD milli_seconds); > > milli_seconds can be INFINITE, or zero, which is used when multi-threading. > > So for 25 minutes, it would be 25*60*100 (100 ms is one second, right?). > > Sleep(150000); > > ___________________________________________________________ > > Abhijit Shylanath > > E-mail: mu...@gm... || ibr...@bi... > Web-site: http://mudeth.tripod.com/ > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: Influence the future > of Java(TM) technology. Join the Java Community > Process(SM) (JCP(SM)) program now. > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en > _______________________________________________ > 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: Abhijit S. <mu...@gm...> - 2002-10-25 12:12:19
|
Greets, Wendel.
> Hi,
>
> I'm trying do my program sleep from 25 to 40 min. I tryed use the funcion
> sleep() but i can't do it. :/
>
> Someone know how to do it ?? Can gave-me a example ??
use Sleep(), declared in <windows.h>
void Sleep(DWORD milli_seconds);
milli_seconds can be INFINITE, or zero, which is used when multi-threading.
So for 25 minutes, it would be 25*60*100 (100 ms is one second, right?).
Sleep(150000);
___________________________________________________________
Abhijit Shylanath
E-mail: mu...@gm... || ibr...@bi...
Web-site: http://mudeth.tripod.com/
|
|
From: Abhijit S. <mu...@gm...> - 2002-10-25 12:12:04
|
Sorry if I'm converging, but I just found 2 cents in my hat... I remember reading on the Allegro list that data alloc'ed in the Allegro DLL is not accessible directly in the executable, so they use some fancy footwork to manage all that. Isn't it unsafe to assume that the heap is shared across programs and libraries? ___________________________________________________________ Abhijit Shylanath E-mail: mu...@gm... || ibr...@bi... Web-site: http://mudeth.tripod.com/ |
|
From: Abhijit S. <mu...@gm...> - 2002-10-25 12:11:46
|
Greets, Charles.
> After linking, i get an error like
> C:\DEV-C++\LIB\\libmingw32.a(main.o)(.text+0x8e): undefine...
> `WinMain@16'
> probably haven't declared any main() or WinMain() func...
> program.
>
> I am still have problems the main() have been declard
>
> This is the small program i was using just make sure everting was working
> right. My first time to use allegro with Dev-c++.
> #include "allegro.h"
>
> int main()
> {
> allegro_init();
> allegro_message("hello world!");
> return 0;
> }
> END_OF_MAIN();
>
> Can you help!
Try #include'ing <winalleg.h> right after <allegro.h>.
___________________________________________________________
Abhijit Shylanath
E-mail: mu...@gm... || ibr...@bi...
Web-site: http://mudeth.tripod.com/
|
|
From: Per W. <pw...@ia...> - 2002-10-25 11:07:35
|
On Fri, 25 Oct 2002, Jerry van Dijk wrote: > > Per Westermark writes: > > > No, actually it isn't that simple. My mail client doesn't have > > any delete line or delete block support. > > Now I am curious, which mailer are you using? I'm using an old pine client through alot of network jumps. > > > I prefer alternative 3. If that isn't an option, then I would have to go > > for alternative 1 - no answer, or 2 - often unreadable answer. > > > > I have at a copule of times tried a unix cut-paste operation. However, > > that requires me to: > > 1 - mark mail test with mouse. > > 2 - open separate editor. > > 3 - paste mouse selection into editor > > 4 - compose new mail. > > 5 - mark editor text with mouse. > > 6 - paste mouse selection into mail client. > > Yes, I know, I do basically the same, as I am also reading the > digest. Although for me it's pretty easy as I use Emacs (*) But I'm not reading the digest version. My answers only contains information from a digest, if someone else have mailed in an unedited digest. > > 1 - mark mail with mouse > 2 - press 'm' to create a new mail message in another frame > 3 - press mouse button to paste in new mail Somewhere trough all network steps - since pine isn't running locally - that paste part doesn't work reliable. I have never seen a paste error in the local editor, but regularly when pasting back the answer into the new mail. > 4 - mark destination address with mouse > 5 - paste destination address with mouse > > And then edit the mail the usual way. Takes about 5 sec. extra. Because of above paste problem, a true estimate for me is 3-5 minutes. Then I'm better off ignoring to answer. > > Mayby you should try Emacs, its useful for a lot of other stuff as well... :-) Without another link setup, emacs or <insert any suitable name here> will get the same problems with the paste operation, since I know it isn't the pine client who fails. > > * Emacs 21.2 with VM-mailer and CUA-mode > > -- > -- Jerry van Dijk | email: jv...@at... > -- Leiden, Holland | web: users.ncrvnet.nl/gmvdijk > > |
|
From: Per W. <pw...@ia...> - 2002-10-25 10:59:41
|
On Fri, 25 Oct 2002, Carlos Garc=EDa del Monte wrote: > Some things about pasts messages, not very important. > The "or when exiting the scope", I wrote it, sorry, I was answering > other question, it was an error when clicking at th mail I wanted to > answer, now I don't remember which mail I was answering. >=20 > One of you said: > If array[0] is logical think there is array[1]. > That's right in programming, not in reality. > Reality: White House is whiteHousesArray[0]. But there is no a second > White House > If I say "I am the third son of my parents" you know there are the > second and the first sons, but you don't know if there is a fourth, or > we have to suppose there are a infinity? You can know previous, not the > following. > Programming: If there is not array[1], why bother writing array[0], when > you can say *array? Good. That was my point. My code used the a->x syntax, since there wasn't a a[1].x to access. In this case, the full expression became myarray[i]->x instead of myarray[i][0].x, since myarray was an array of pointers to single element, i.e. one-dimensional. >=20 > Although vector has the mathematical meaning of one dimensional array, > and we were talking about C, it would be better leave 'vector' for the > STL container, because that's our (or my) first thought when see > 'vector' here, so I read understanding one thing and in the middle of > the message, or some messages later, I notice I've misunderstood > everything, or simply I expected other thing. I was tempted to not read > this thread of messages, losing some interesting things. >=20 >=20 >=20 > ------------------------------------------------------- > This sf.net email is sponsored by: Influence the future=20 > of Java(TM) technology. Join the Java Community=20 > Process(SM) (JCP(SM)) program now.=20 > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en > _______________________________________________ > 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 >=20 |
|
From: Per W. <pw...@ia...> - 2002-10-25 10:54:19
|
Exactly why my previous mail specified use-cases. - Sparse matrix, where a lot of entries are NULL. - Quick sort, since it's enough to move the pointers. - Different object types for each index, simulating C++ abstract base class. - Supports large vector in 16-bit code, where it's possible to have 16000 entries of up to 64000 byte size each. /Per W On Fri, 25 Oct 2002, Ioannis Vranos wrote: > > -----Original Message----- > > From: Ioannis Vranos [mailto:no...@ho...] > > Sent: Friday, October 25, 2002 12:39 PM > > To: Dev-C++ Mailing List (dev...@li...) > > Subject: RE: [Dev-C++] dynamic allocation and structs > > > > > > > -----Original Message----- > > > From: Per Westermark [mailto:pw...@ia...] > > > Sent: Friday, October 25, 2002 11:51 AM > > > To: Ioannis Vranos > > > Cc: 'Dev-C++ Mailing List' > > > Subject: RE: [Dev-C++] dynamic allocation and structs > > > > > > > > > The trick is that vector isn't programming. It is a standard > > > - and very > > > old - mathematical term for a one-dimensional matrix. > > > > > > Yes, but when we speak of C++ code, calling a built in array > > a "vector" can only be confusing. > > > > > > > > > There has been > > > millions of vector implementations before STL did a template > > > version, and > > > the probability of a finding a STL construct in a C program > > > is not that > > > high :-) > > > > > > Yes, but it still can be confusing to C++ programmers. > > > > > > > > > > > > While code might syntactically switch around between > > > (*a).x, > > > a->x > > > a[0].x > > > > > > the third form is definitely dangerous to use when a is only > > > a pointer to > > > a single element. If there is an element zero, the logical > > > conclusion is > > > that there must be a element one. > > > > > > Yes, if there is only one element i would use the -> only. > > When we have more the [] is more suitable. Both are valid. > > Also i cannot understand why someone would create a single dimensional > array of pointers on the free store and then assign an element on the > free store to each of them. It's a total waste of everything. :) Using a > simple pointer and allocating space for the elements directly on the > free store would be a reasonable thing to do. > > /* Array of 100 mystructs on the free store */ > struct mystruct *p=malloc(100*sizeof(*p)); > > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.freeurl.com > * Alternative URL: http://run.to/noicys > > > ------------------------------------------------------- > This sf.net email is sponsored by: Influence the future > of Java(TM) technology. Join the Java Community > Process(SM) (JCP(SM)) program now. > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en > _______________________________________________ > 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: Jerry v. D. <jv...@at...> - 2002-10-25 10:51:05
|
Per Westermark writes: > No, actually it isn't that simple. My mail client doesn't have > any delete line or delete block support. Now I am curious, which mailer are you using? > I prefer alternative 3. If that isn't an option, then I would have to go > for alternative 1 - no answer, or 2 - often unreadable answer. > > I have at a copule of times tried a unix cut-paste operation. However, > that requires me to: > 1 - mark mail test with mouse. > 2 - open separate editor. > 3 - paste mouse selection into editor > 4 - compose new mail. > 5 - mark editor text with mouse. > 6 - paste mouse selection into mail client. Yes, I know, I do basically the same, as I am also reading the digest. Although for me it's pretty easy as I use Emacs (*) 1 - mark mail with mouse 2 - press 'm' to create a new mail message in another frame 3 - press mouse button to paste in new mail 4 - mark destination address with mouse 5 - paste destination address with mouse And then edit the mail the usual way. Takes about 5 sec. extra. Mayby you should try Emacs, its useful for a lot of other stuff as well... :-) * Emacs 21.2 with VM-mailer and CUA-mode -- -- Jerry van Dijk | email: jv...@at... -- Leiden, Holland | web: users.ncrvnet.nl/gmvdijk |
|
From: Carlos d. M. <cg...@wo...> - 2002-10-25 10:20:10
|
Some things about pasts messages, not very important. The "or when exiting the scope", I wrote it, sorry, I was answering other question, it was an error when clicking at th mail I wanted to answer, now I don't remember which mail I was answering. One of you said: If array[0] is logical think there is array[1]. That's right in programming, not in reality. Reality: White House is whiteHousesArray[0]. But there is no a second White House If I say "I am the third son of my parents" you know there are the second and the first sons, but you don't know if there is a fourth, or we have to suppose there are a infinity? You can know previous, not the following. Programming: If there is not array[1], why bother writing array[0], when you can say *array? Although vector has the mathematical meaning of one dimensional array, and we were talking about C, it would be better leave 'vector' for the STL container, because that's our (or my) first thought when see 'vector' here, so I read understanding one thing and in the middle of the message, or some messages later, I notice I've misunderstood everything, or simply I expected other thing. I was tempted to not read this thread of messages, losing some interesting things. |
|
From: Per W. <pw...@ia...> - 2002-10-25 09:44:06
|
Same answer as to previous mail. We were specifically talking about a C implementation. By the way, a vector is a vector in C, C++, Java, Fortran, Modula 2, Pascal, ... It isn't about the language, but about the concept. And it doesn't matter if I implement it myself, buy an existing library or have it built into the language. /Per W On Fri, 25 Oct 2002, Ioannis Vranos wrote: > > -----Original Message----- > > From: Per Westermark [mailto:pw...@ia...] > > Sent: Friday, October 25, 2002 11:51 AM > > To: Ioannis Vranos > > Cc: 'Dev-C++ Mailing List' > > Subject: RE: [Dev-C++] dynamic allocation and structs > > > > > > The trick is that vector isn't programming. It is a standard > > - and very > > old - mathematical term for a one-dimensional matrix. > > > Yes, but when we speak of C++ code, calling a built in array a "vector" > can only be confusing. > > > > > There has been > > millions of vector implementations before STL did a template > > version, and > > the probability of a finding a STL construct in a C program > > is not that > > high :-) > > > Yes, but it still can be confusing to C++ programmers. > > > > > > > While code might syntactically switch around between > > (*a).x, > > a->x > > a[0].x > > > > the third form is definitely dangerous to use when a is only > > a pointer to > > a single element. If there is an element zero, the logical > > conclusion is > > that there must be a element one. > > > Yes, if there is only one element i would use the -> only. When we have > more the [] is more suitable. Both are valid. > > > > > > > > While one goal of programming is to make the programs work, > > it shouldn't > > be neglected that comming generations of programmers > > inherriting old code > > does immediately see what the code does. When seeing a x[0] > > statement, the > > natural reaction is - or should be - to start hunt for the > > total size of > > the vector. > > > Yes. However i did created a 200x100 array on the free store so the > second [] was suitable. :) > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.freeurl.com > * Alternative URL: http://run.to/noicys > > > > ------------------------------------------------------- > This sf.net email is sponsored by: Influence the future > of Java(TM) technology. Join the Java Community > Process(SM) (JCP(SM)) program now. > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Ioannis V. <no...@ho...> - 2002-10-25 09:43:58
|
> -----Original Message----- > From: Ioannis Vranos [mailto:no...@ho...] > Sent: Friday, October 25, 2002 12:39 PM > To: Dev-C++ Mailing List (dev...@li...) > Subject: RE: [Dev-C++] dynamic allocation and structs > > > > -----Original Message----- > > From: Per Westermark [mailto:pw...@ia...] > > Sent: Friday, October 25, 2002 11:51 AM > > To: Ioannis Vranos > > Cc: 'Dev-C++ Mailing List' > > Subject: RE: [Dev-C++] dynamic allocation and structs > > > > > > The trick is that vector isn't programming. It is a standard > > - and very > > old - mathematical term for a one-dimensional matrix. > > > Yes, but when we speak of C++ code, calling a built in array > a "vector" can only be confusing. > > > > > There has been > > millions of vector implementations before STL did a template > > version, and > > the probability of a finding a STL construct in a C program > > is not that > > high :-) > > > Yes, but it still can be confusing to C++ programmers. > > > > > > > While code might syntactically switch around between > > (*a).x, > > a->x > > a[0].x > > > > the third form is definitely dangerous to use when a is only > > a pointer to > > a single element. If there is an element zero, the logical > > conclusion is > > that there must be a element one. > > > Yes, if there is only one element i would use the -> only. > When we have more the [] is more suitable. Both are valid. Also i cannot understand why someone would create a single dimensional array of pointers on the free store and then assign an element on the free store to each of them. It's a total waste of everything. :) Using a simple pointer and allocating space for the elements directly on the free store would be a reasonable thing to do. /* Array of 100 mystructs on the free store */ struct mystruct *p=malloc(100*sizeof(*p)); Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |
|
From: <chr...@cr...> - 2002-10-25 09:43:54
|
Who help me ? If i compiled this project with devcpp 4.9.6, i have messages
:
3 C:\Dev-Cpp\struc.c [Warning] `struct Forme' declared inside parameter
list
3 C:\Dev-Cpp\struc.c [Warning] its scope is only this definition or
declaration, which is probably
not what you want.
C:\Dev-Cpp\struc.c [Warning] In function `change_structure':
5 C:\Dev-Cpp\struc.c dereferencing pointer to incomplete type
6 C:\Dev-Cpp\struc.c dereferencing pointer to incomplete type
C:\Dev-Cpp\Makefile.win [Build Error] [struc.o] Error 1
Thanks for your help.
main.c
#include <stdio.h>
struct Forme
{
int type;
int couleur;
};
void change_structure(struct Forme *Forme);
int main(int argc, char *argv[])
{
struct Forme cercle;
change_structure(&cercle);
printf("cercle.type %d\n", cercle.type);
printf("cercle.couleur %d\n", cercle.couleur);
system("PAUSE");
return 0;
}
struc.c
void change_structure(struct Forme *Forme)
{
(*Forme).type=0;
(*Forme).couleur=1;
}
|
|
From: Ioannis V. <no...@ho...> - 2002-10-25 09:38:54
|
> -----Original Message----- > From: Per Westermark [mailto:pw...@ia...] > Sent: Friday, October 25, 2002 11:51 AM > To: Ioannis Vranos > Cc: 'Dev-C++ Mailing List' > Subject: RE: [Dev-C++] dynamic allocation and structs > > > The trick is that vector isn't programming. It is a standard > - and very > old - mathematical term for a one-dimensional matrix. Yes, but when we speak of C++ code, calling a built in array a "vector" can only be confusing. > There has been > millions of vector implementations before STL did a template > version, and > the probability of a finding a STL construct in a C program > is not that > high :-) Yes, but it still can be confusing to C++ programmers. > > While code might syntactically switch around between > (*a).x, > a->x > a[0].x > > the third form is definitely dangerous to use when a is only > a pointer to > a single element. If there is an element zero, the logical > conclusion is > that there must be a element one. Yes, if there is only one element i would use the -> only. When we have more the [] is more suitable. Both are valid. > > While one goal of programming is to make the programs work, > it shouldn't > be neglected that comming generations of programmers > inherriting old code > does immediately see what the code does. When seeing a x[0] > statement, the > natural reaction is - or should be - to start hunt for the > total size of > the vector. Yes. However i did created a 200x100 array on the free store so the second [] was suitable. :) Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |
|
From: Per W. <pw...@ia...> - 2002-10-25 08:50:59
|
The trick is that vector isn't programming. It is a standard - and very old - mathematical term for a one-dimensional matrix. There has been millions of vector implementations before STL did a template version, and the probability of a finding a STL construct in a C program is not that high :-) While code might syntactically switch around between (*a).x, a->x a[0].x the third form is definitely dangerous to use when a is only a pointer to a single element. If there is an element zero, the logical conclusion is that there must be a element one. While one goal of programming is to make the programs work, it shouldn't be neglected that comming generations of programmers inherriting old code does immediately see what the code does. When seeing a x[0] statement, the natural reaction is - or should be - to start hunt for the total size of the vector. /Per W On Fri, 25 Oct 2002, Ioannis Vranos wrote: > > -----Original Message----- > > From: Per Westermark [mailto:pw...@ia...] > > Sent: Friday, October 25, 2002 10:53 AM > > To: Ioannis Vranos > > Cc: Dev-C++ Mailing List > > Subject: RE: [Dev-C++] dynamic allocation and structs > > > > > > The term vector is valid, since the allocated information is > > only supposed > > to be used with one single index, i.e. one-dimensional. > > > I said avoid using the term "vector" for built-in arrays so as to not > confuse them with C++'s standard library vectors. Call them "built in > arrays". > > > > > It must always be observed - yes this is outside scope of Dev-C++ but > > standard C/C++ requirements - that a while a pointer might > > point to the > > forst element of a vector, i.e. > > mystruct *p; > > p[0].x = 1; > > p[1].x = 2; > > ... > > it is not required or guaranteed that there are more than one > > element the > > pointer is pointing at. Never assume a p[1] just because p[0] is fine. > > The code below uses vector[i]->id, not vector[i][0].id, to > > signify that > > this is a one-dimensional allocation, and that while the > > compiler would > > accept vector[i][0], vector[i][1], vector[i][1] would point outside > > allocated memory. > > > i think the second [] swits better notationally. It's a personal taste. > > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.freeurl.com > * Alternative URL: http://run.to/noicys > > > ------------------------------------------------------- > This sf.net email is sponsored by: Influence the future > of Java(TM) technology. Join the Java Community > Process(SM) (JCP(SM)) program now. > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en > _______________________________________________ > 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: Per W. <pw...@ia...> - 2002-10-25 08:10:18
|
It doesn't matter where you define it, as long as the compiler may see the pen when inside the draw code. However, if you keep a global pen, you must make sure that whenever the user is changing colour, line width etc, you have to unselect and free the old pen and create a new pen. /Per W |
|
From: Per W. <pw...@ia...> - 2002-10-25 08:04:57
|
No, actually it isn't that simple. My mail client doesn't have any delete line or delete block support. But you are in part correct. Anyone reading this list in digest form should do whatever necessary to split the digest before answering, and in this special case, I might have answered without any of the original text. But, in the general case, I only have the following alternatives. 1 - I could totally ignore answering. 2 - I could answer without query text. However, many questions do require the query text. 3 - I could answer the mail as-is. 4 - I could spend a couple minutes with my delete button pressed. But that would of course result in too many lines being deleted, especially since I'm running through a telnet connection, jumping a lot of computers on the route which means I regularly have significant lag between button press and visible action. I prefer alternative 3. If that isn't an option, then I would have to go for alternative 1 - no answer, or 2 - often unreadable answer. I have at a copule of times tried a unix cut-paste operation. However, that requires me to: 1 - mark mail test with mouse. 2 - open separate editor. 3 - paste mouse selection into editor 4 - compose new mail. 5 - mark editor text with mouse. 6 - paste mouse selection into mail client. However, that method has at several times result in lost characters, words or even complete lines in the finished mail (unreliable transport, or buffer overrun somewhere). And since the mail client doesn't support line/block delete, I would - in case I notice a significant problem - have to spend a couple of minutes trying to delete all text again... /Per W On Fri, 25 Oct 2002, Jerry van Dijk wrote: > > Per, > > Please note that your single email was more than 32Kb and used a complete > digest, as you quoted the complete previous digest. As you did this before > could you please trim your posts, out of respect for others peoples phonebill? > :-) > > -- > -- Jerry van Dijk | email: jv...@at... > -- Leiden, Holland | web: users.ncrvnet.nl/gmvdijk > > |
|
From: Ioannis V. <no...@ho...> - 2002-10-25 08:03:21
|
> -----Original Message----- > From: Per Westermark [mailto:pw...@ia...] > Sent: Friday, October 25, 2002 10:53 AM > To: Ioannis Vranos > Cc: Dev-C++ Mailing List > Subject: RE: [Dev-C++] dynamic allocation and structs > > > The term vector is valid, since the allocated information is > only supposed > to be used with one single index, i.e. one-dimensional. I said avoid using the term "vector" for built-in arrays so as to not confuse them with C++'s standard library vectors. Call them "built in arrays". > It must always be observed - yes this is outside scope of Dev-C++ but > standard C/C++ requirements - that a while a pointer might > point to the > forst element of a vector, i.e. > mystruct *p; > p[0].x = 1; > p[1].x = 2; > ... > it is not required or guaranteed that there are more than one > element the > pointer is pointing at. Never assume a p[1] just because p[0] is fine. > The code below uses vector[i]->id, not vector[i][0].id, to > signify that > this is a one-dimensional allocation, and that while the > compiler would > accept vector[i][0], vector[i][1], vector[i][1] would point outside > allocated memory. i think the second [] swits better notationally. It's a personal taste. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |
|
From: Per W. <pw...@ia...> - 2002-10-25 07:53:49
|
The term vector is valid, since the allocated information is only supposed
to be used with one single index, i.e. one-dimensional.
It must always be observed - yes this is outside scope of Dev-C++ but
standard C/C++ requirements - that a while a pointer might point to the
forst element of a vector, i.e.
mystruct *p;
p[0].x = 1;
p[1].x = 2;
...
it is not required or guaranteed that there are more than one element the
pointer is pointing at. Never assume a p[1] just because p[0] is fine.
The code below uses vector[i]->id, not vector[i][0].id, to signify that
this is a one-dimensional allocation, and that while the compiler would
accept vector[i][0], vector[i][1], vector[i][1] would point outside
allocated memory.
Full source compilable in c:
----test.c----
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Obviously this struct should contain more than just an integer.
typedef struct {
int id;
char *str;
} mystruct;
int cmp(const void* a,const void* b) {
const mystruct *p1 = *(const mystruct**)a;
const mystruct *p2 = *(const mystruct**)b;
return p1->id - p2->id;
}
int main() {
const int count = 10;
mystruct **vector;
char buf[100];
int i;
// Allocate vector of pointers TO SINGLE ELEMENTS!
// Yes, it does look like allocating vector of pointers to vectors,
// but that is the charm of C/C++. It is up to the end user to
// know if a pointer points to first element of a vector, or just
// to a single element.
vector = (mystruct**)malloc(count*sizeof(mystruct*));
for (i = 0; i < count; i++) {
// Allocate count number of single elements.
vector[i] = (mystruct*)malloc(sizeof(mystruct));
}
// Assign values.
for (i = 0; i < count; i++) {
vector[i]->id = rand()%100;
sprintf(buf,"This was element vector[%d]",i);
vector[i]->str = strdup(buf);
}
// Sort values.
qsort(vector,count,sizeof(*vector),cmp);
// Print values.
for (i = 0; i < count; i++) {
printf("Vector element %d has value %d and str '%s'\n",
i,vector[i]->id,vector[i]->str);
}
// Clean up.
for (i = 0; i < count; i++) {
free(vector[i]->str);
free(vector[i]);
}
free(vector);
return 0;
}
-------------------
/Per W
On Fri, 25 Oct 2002, Ioannis Vranos wrote:
> > -----Original Message-----
> > From: Per Westermark [mailto:pw...@ia...]
> > Sent: Friday, October 25, 2002 1:02 AM
> > To: Ioannis Vranos
> > Cc: dev...@li...
> > Subject: RE: [Dev-C++] dynamic allocation and structs
> >
> >
> > Well Ioannis, I did manage to get a star on the wrong side of
> > the struct
> > type name, see inserted correction below, so the example was slightly
> > broken. However, the example was not a total goose chase try at a
> > two-dimensional matrix of entries, but an example of creating a
> > one-dimensional matrix (a vector) of pointers to single
> > entries, which was
> > exactly what the heading suggested "array of pointers to
> > entries".
>
>
> Lets avoid using the term "vector". Well an array of single pointers is
> a 2 dimensional array of elements so it is the same.
>
>
> > If the
> > code wasn't obvious, a hint to that fact should have been that I only
> > used a single for loop to assign values to the entries.
>
> Which i think doesn't work.
>
>
>
> >
> > One reason to use alternative two, a vector of pointers to elements
> > instead of a vector of elements, is that sorting of the vector only
> > require changing the place of the pointers, instead of
> > copying the full
> > structures.
>
>
> So you wanted to create a single-dimentional array of elements? Then a
> single * would be enough.
>
>
>
> >
> > Another reason is that it might be used to create a sparse
> > matrix, where
> > the vector might be very long, but only some index values of
> > the vector
> > will have an allocated entry.
> >
> > A third reason is that a vector of pointers might be to store
> > different
> > types of structs in the same vector, as in:
> >
> > enum {
> > CIRCLE,
> > LINE,
> > BOX
> > };
> >
> > struct Circle {
> > int type;
> > int x,y;
> > int radius;
> > };
> >
> > struct Line {
> > int type;
> > int x1,y1,x2,y2;
> > }
> >
> > struct Box {
> > int type;
> > int x1,y1,x2,y2;
> > };
> >
> > void fill_array() {
> > Circle *pCircle;
> > Line *pLine;
> > Box *pBox;
> > int item_count,i;
> >
> > item_count = 0;
> > pCircle = (Circle*)malloc(sizeof(Circle));
> > pCircle->type = CIRCLE;
> > pCircle->x = 10;
> > pCircle->y = 20;
> > pCircle->radius = 5;
> > myarray[item_count++] = pCircle;
> >
> > pBox = (Box*)malloc(sizeof(Box));
> > pBox->type = BOX;
> > pBox->x1 = 15;
> > pBox->y1 = 2;
> > pBox->x2 = 18;
> > pBox->y2 = 5;
> > myarray[item_count++] = pBox;
> >
> > ...
> >
> > // Draw items.
> > for (i = 0; i < item_count; i++) {
> > if (myarray[i]) {
> > switch (myarray[i]->type) {
> > case CIRCLE:
> > pCircle = (Circle*)myarray[i];
> > // Draw circle
> > break;
> > case BOX:
> > pBox = (Box*)myarray[i];
> > // Draw box
> > break;
> > case LINE:
> > pLine = (Line*)myarray[i];
> > // Draw line
> > break;
> > default:
> > // Complain about unsupported object type.
> > }
> > }
> > }
>
>
> I did not get your meaning. Where is myarray definition. I assume
> myarray is a single arrray of void *. And?
>
> Ioannis
>
> * Ioannis Vranos
> * Programming pages: http://www.noicys.freeurl.com
> * Alternative URL: http://run.to/noicys
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: Influence the future
> of Java(TM) technology. Join the Java Community
> Process(SM) (JCP(SM)) program now.
> http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0003en
> _______________________________________________
> 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: Vlada D. <dj...@im...> - 2002-10-25 07:04:08
|
----- Original Message -----
From: "Per Westermark" <pw...@ia...>
To: "Vlada Djurovic" <dj...@im...>
Cc: "Daniel Glenfield" <sp...@ho...>;
<dev...@li...>
Sent: Thursday, October 24, 2002 3:19 PM
Subject: Re: [Dev-C++] Whoops - drawing in Windows
> One question: Aren't you creating a lot of pens in your drawing loop.
> Every time the mouse is moved, you create a new pen, with the same
> specification as the pen you crated at your previous mouse move.
>
> Exactly where are the "consumed" pens supposed to be released? At least in
> Win32, you only have a finite set of available resource handles, so it
> isn't possible to create new pens all the time. The task manager in Win2k
> or WinXP may be configured to display number of handles used in the
> application. That number shouldn't continuously increase when the program
> is run.
>
If I understand correct, you say I should create one global pen object and
use it every time I need to draw something. Where should that object be
defined?
> Leaking pens, brushes, ... is a quick way of getting a program into
> troubles - a lot more quickly than if the program leaks memory. There is
> no swapping for resources.
>
Can it be the reason for the program to freeze?
> /Per W
>
> On Thu, 24 Oct 2002, Vlada Djurovic wrote:
>
> >
> > ----- Original Message -----
> > From: "Daniel Glenfield" <sp...@ho...>
> > To: <dj...@im...>; <dev...@li...>
> > Sent: Thursday, October 24, 2002 11:59 AM
> > Subject: Re: [Dev-C++] Whoops - drawing in Windows
> >
> >
> > > Nope maybe not, serialising is for saving and restoring.
> > >
> > > I think you have to store the info in to an array, but looking at this
old
> > > code I cannot remember what exactly you have to do. I worked on the
> > Scribble
> > > tutorial that comes with VC++ - have a look on MSDN for it.
> > >
> > >
> > I tried to store all the info in a linked list, but I think I did
something
> > wrong because the program just froze when I tried to draw something.
Then I
> > thought it would be easier to store the drawing in a compatible memory
> > bitmap and then just copy it back in the client area when it needs to be
> > redrawn, but this also didn't work because the program froze again.
That's
> > why I was asking if anyone can give me some guidelines about how to do
this
> > (the bitmap way).
> > As for the tutorials, I read the book "Teach yourself VC++ in 21 days"
which
> > also has some stuff about this, but although I think I did everything
the
> > way it's done in VC++- it doesn't work.
> >
> > Regards, Vlada
> > >
> > > >From: "Vlada Djurovic" <dj...@im...>
> > > >To: "'DevC++ help'" <dev...@li...>
> > > >Subject: [Dev-C++] drawing in Windows
> > > >Date: Thu, 24 Oct 2002 10:32:16 +0200
> > > >
> > > >Hi, everybody
> > > >Here's my problem: I'm trying to write a simple drawing app (just for
> > > >exercise) and so far its been going OK. I can draw lines in client
area
> > in
> > > >different colors, but when ever I minimize or maximize the window, or
> > > >something similar happenes, all the content of the window is gone. I
> > tried
> > > >to use a memory DC an bitmap to save the contents in, and BitBlt it
back
> > in
> > > >response to WM_PAINT message, but the program just "froze". Can
anybody
> > > >give me a hint how to do it? Here's the code used for drawing lines
> > without
> > > >any restoring parts:
> > > >
> > > > case WM_MOUSEMOVE:
> > > > {
> > > > switch(iTool) /* iTool is used for dtetrmining
> > which
> > > >drawing tool is selected(line, rect etc.)*/
> > > > {
> > > > case 0:
> > > > {
> > > > if(wParam==MK_LBUTTON) /*if line is selected
> > > >(itool=0) and left button presed*/
> > > > {
> > > > HDC hDC=GetDC(hwnd);
> > > >
> > > > HPEN
> > hPen=CreatePen(PS_SOLID,iCurWidth,crCurColor);
> > > > HPEN hOldPen=(HPEN)SelectObject(hDC,hPen);
> > > > CLine* pLine=new
> > > >CLine(ptPrevPos,MAKEPOINTS(lParam),iCurWidth,crCurColor); /*create
new
> > line
> > > >object*/
> > > > pLine->DrawLine(hDC);
> > > > ptPrevPos=MAKEPOINTS(lParam);
> > > > SelectObject(hDC,hOldPen);
> > > > DeleteDC(hDC);
> > > > }
> > > > }
> > > > break;
> > > > case 1: /* nothing here yet*/
> > > > break;
> > > > }
> > > > }
> > >
> > >
> > > _________________________________________________________________
> > > Get a speedy connection with MSN Broadband. Join now!
> > > http://resourcecenter.msn.com/access/plans/freeactivation.asp
> > >
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by: Influence the future
> > of Java(TM) technology. Join the Java Community
> > Process(SM) (JCP(SM)) program now.
> >
http://ad.doubleclick.net/clk;4729346;7592162;s?http://www.sun.com/javavote
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
|
|
From: Ioannis V. <no...@ho...> - 2002-10-25 02:26:11
|
> -----Original Message-----
> From: Per Westermark [mailto:pw...@ia...]
> Sent: Friday, October 25, 2002 1:02 AM
> To: Ioannis Vranos
> Cc: dev...@li...
> Subject: RE: [Dev-C++] dynamic allocation and structs
>
>
> Well Ioannis, I did manage to get a star on the wrong side of
> the struct
> type name, see inserted correction below, so the example was slightly
> broken. However, the example was not a total goose chase try at a
> two-dimensional matrix of entries, but an example of creating a
> one-dimensional matrix (a vector) of pointers to single
> entries, which was
> exactly what the heading suggested "array of pointers to
> entries".
Lets avoid using the term "vector". Well an array of single pointers is
a 2 dimensional array of elements so it is the same.
> If the
> code wasn't obvious, a hint to that fact should have been that I only
> used a single for loop to assign values to the entries.
Which i think doesn't work.
>
> One reason to use alternative two, a vector of pointers to elements
> instead of a vector of elements, is that sorting of the vector only
> require changing the place of the pointers, instead of
> copying the full
> structures.
So you wanted to create a single-dimentional array of elements? Then a
single * would be enough.
>
> Another reason is that it might be used to create a sparse
> matrix, where
> the vector might be very long, but only some index values of
> the vector
> will have an allocated entry.
>
> A third reason is that a vector of pointers might be to store
> different
> types of structs in the same vector, as in:
>
> enum {
> CIRCLE,
> LINE,
> BOX
> };
>
> struct Circle {
> int type;
> int x,y;
> int radius;
> };
>
> struct Line {
> int type;
> int x1,y1,x2,y2;
> }
>
> struct Box {
> int type;
> int x1,y1,x2,y2;
> };
>
> void fill_array() {
> Circle *pCircle;
> Line *pLine;
> Box *pBox;
> int item_count,i;
>
> item_count = 0;
> pCircle = (Circle*)malloc(sizeof(Circle));
> pCircle->type = CIRCLE;
> pCircle->x = 10;
> pCircle->y = 20;
> pCircle->radius = 5;
> myarray[item_count++] = pCircle;
>
> pBox = (Box*)malloc(sizeof(Box));
> pBox->type = BOX;
> pBox->x1 = 15;
> pBox->y1 = 2;
> pBox->x2 = 18;
> pBox->y2 = 5;
> myarray[item_count++] = pBox;
>
> ...
>
> // Draw items.
> for (i = 0; i < item_count; i++) {
> if (myarray[i]) {
> switch (myarray[i]->type) {
> case CIRCLE:
> pCircle = (Circle*)myarray[i];
> // Draw circle
> break;
> case BOX:
> pBox = (Box*)myarray[i];
> // Draw box
> break;
> case LINE:
> pLine = (Line*)myarray[i];
> // Draw line
> break;
> default:
> // Complain about unsupported object type.
> }
> }
> }
I did not get your meaning. Where is myarray definition. I assume
myarray is a single arrray of void *. And?
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL: http://run.to/noicys
|
|
From: Charles C. <can...@ho...> - 2002-10-25 00:33:25
|
After linking, i get an error like
C:\DEV-C++\LIB\\libmingw32.a(main.o)(.text+0x8e): undefine...
`WinMain@16'
probably haven't declared any main() or WinMain() func...
program.
I am still have problems the main() have been declard
This is the small program i was using just make sure everting was working
right. My first time to use allegro with Dev-c++.
#include "allegro.h"
int main()
{
allegro_init();
allegro_message("hello world!");
return 0;
}
END_OF_MAIN();
Can you help!
_________________________________________________________________
Surf the Web without missing calls! Get MSN Broadband.
http://resourcecenter.msn.com/access/plans/freeactivation.asp
|
|
From: Jerry v. D. <jv...@at...> - 2002-10-24 23:36:53
|
Per, Please note that your single email was more than 32Kb and used a complete digest, as you quoted the complete previous digest. As you did this before could you please trim your posts, out of respect for others peoples phonebill? :-) -- -- Jerry van Dijk | email: jv...@at... -- Leiden, Holland | web: users.ncrvnet.nl/gmvdijk |