dev-cpp-users Mailing List for Dev-C++ (Page 686)
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-07-06 15:39:50
|
a small correction > e.g. vector<int *>integers(5); > integers[0]=new int(5); // it is like we assign then integers[0]=5; it is like we assign then *integers[0]=5; Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys |
|
From: Ioannis V. <no...@ya...> - 2001-07-06 15:32:21
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Phil Schulz > Sent: Friday, July 06, 2001 4:17 AM > To: dev...@li... > Subject: [Dev-C++] STL, iterators and pointers? > > > > Some questions about the STL containers and iterators. > > When you insert an object into a multiset (or list, etc.) > does it create a copy of the original Object, or does it > connect to the original? When you say "multiset" i consider that you mean standard library container. When you create an object of a container type containing a standard object type then the number specified of objects are created. E.g.. vector<string> l(10); creates an array (vector) of 10 string objects with the name l; These 10 string objects are created with the creation of the vector. so if we have string s="Test"; l[0]=s; s is COPIED in l[0]; Now if you create a vector of pointers e.g. vector<string *> pointers(10); pointers[0]=&s; pointer[0] is pointing to our string s; > > and I'm not sure how to ask this next one: > If you have an iterator for the above multiset, can you get a generic > Object* out of it that points to the Object? I tried taking > the addressof the dereferenced iterator ( &(*iter) ) but that > didn't seem to work out quite right... > iterators act like pointers but they are not pointers. the &(*iter) of yours should work. Perhaps the container contained pointers and not objects? e.g. vector<int *>integers(5); integers[0]=new int(5); // it is like we assign then integers[0]=5; vector<int *>::iterator iter=integers.begin(); int *p; p=*iter // and NOT &(*iter) since the container contains pointers and our iterator behaves like int ** > > Why I'm asking: > I have two classes, Book and Author that each contain a > pointer to the other. > > I have a multiset of Books, and a multiset of Authors. When I > add a new Book, I need to be able to link it to an Author, > and vice versa. The > Book* I get when I make a new object doesn't correspond to > where the iterator is pointing. Probably you made some mistakes on the assignment, check what i wrote above. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys |
|
From: <jar...@ig...> - 2001-07-06 09:30:34
|
Has anybody INF-files to build a Dev-C++ package (e.g. by paquet builder)? Thanks for any hints Helmut Jarausch Lehrstuhl fuer Numerische Mathematik Institute of Technology, RWTH Aachen D 52056 Aachen, Germany |
|
From: Luigi S. <gi...@li...> - 2001-07-06 04:54:57
|
At 22.51 05/07/01 +0000, you wrote:
>hi everyone, i hope someone can help me. at the moment i am writing a
>program, heres what i want it to do:
>
>i want it to open a text document that i have created and i want it to
>search for '$$$$$' (after this there is some text i want). i then want it
>to read the text that follows.
>...
>_________________________________________________________________________
Ian -
I hope that the following example code is of help
test.cpp
---------
// test the look_for function
#include <fstream.h>
#include "lookfor.h"
int
main(int argc, char **argv)
{
if (argc != 3)
cerr << "usage: " << *argv << " file key\n";
else
{
const char *fname = argv[1];
ifstream file(fname); // open the text file
string key = argv[2];
cout << "key is : \"" << key << "\"\n";
if (look_for(file, key)) // load the value
{
string val;
file >> val;
cout << "value is : \"" << val << "\"\n";
}
else
cout << "sorry key not found in \"" << fname << "\"\n";
}
return 0;
}
lookfor.h
------------
#ifndef lookfor_h
#define lookfor_h
#include <iostream>
#include <string>
// look_for = look for the key on the stream is, return true if found
bool
look_for(istream &is, const string &key);
#endif
lookfor.cpp
---------------
#include "lookfor.h"
bool
look_for(istream &is, const string &key)
{
bool found = false;
string s;
while (!found && is >> s)
found = (s == key);
return found;
}
here is the test data
test.dat
----------
file to be used as input for "test"
key_1: $$$$$ value_1
key_2: &&&&& value_2
...
try the following commands:
test test.dat $$$$$
test test.dat $$$$
---
gisan
|
|
From: Phil S. <fy...@qw...> - 2001-07-06 02:16:36
|
Some questions about the STL containers and iterators. When you insert an object into a multiset (or list, etc.) does it create a copy of the original Object, or does it connect to the original? and I'm not sure how to ask this next one: If you have an iterator for the above multiset, can you get a generic Object* out of it that points to the Object? I tried taking the addressof the dereferenced iterator ( &(*iter) ) but that didn't seem to work out quite right... Why I'm asking: I have two classes, Book and Author that each contain a pointer to the other. I have a multiset of Books, and a multiset of Authors. When I add a new Book, I need to be able to link it to an Author, and vice versa. The Book* I get when I make a new object doesn't correspond to where the iterator is pointing. I guess that I could do this easier if I replaced the reciprical pointers with multiset iterators, but I want to make the Book and Author classes as basic as possible. I'm experimenting with the different STL containers. and I want to not have to adapt the classes for each one. Hoping this makes sense, Phil -- Fy...@qw... |
|
From: Ian W. <lak...@ho...> - 2001-07-05 22:51:13
|
hi everyone, i hope someone can help me. at the moment i am writing a program, heres what i want it to do: i want it to open a text document that i have created and i want it to search for '$$$$$' (after this there is some text i want). i then want it to read the text that follows. i use 'fstream.h' in my program if that helps. if anyone can help me i would be very thankful. _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. |
|
From: <jar...@ig...> - 2001-07-05 19:35:15
|
On 4 Jul, Elias Pschernig wrote: >> > Did you use the right patch for your OS ? >> > http://sourceforge.net/project/showfiles.php?group_id=2435&release_id=38543 >> >> There is only one (sort of) package for the Win9x family. >> I even tried to install only the gcc package (and not the recent >> binutils) but I get the same error. >> Unfortunately I don't know if g++ or Dev-C++ generates the error >> message. >> > > Try this: > > gcc-2.95.3-20010613-W95patch.tar.gz > > Unzip it into the same foler as mingw-1.0-20010608.tar.gz, overwriting files > already there. Be sure not to use the dev-c++ directory, but use a new > directory (where you only install these 2 zips) - and just alter the pathes. > Many thanks, this works. gcc-2.95.3-20010613-W95patch.tar.gz is necessary on my Win-Me system, also. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik Institute of Technology, RWTH Aachen D 52056 Aachen, Germany |
|
From: <jar...@ig...> - 2001-07-05 19:16:45
|
Hi, I have install the 4.01 version and with many help from this group I have replaced the gcc-2.95.2 mingw system by the more recent mingw-1.0-20010608.tar.gz plus gcc-2.95.3-20010613-W95patch.tar.gz plus some own libraries Now I would like to generate a package for my students which is easy to install. I have a Dev-Cpp.zip file but there is more (a registery update, etc) Does anybody know how to do that? Thanks for any hints, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik Institute of Technology, RWTH Aachen D 52056 Aachen, Germany |
|
From: Elias P. <eli...@ao...> - 2001-07-04 13:25:52
|
... > Now if this is writen to the File we do it as > > fwrite(&oHeader,sizeof(oHeader),1,outfile); > > Meaning the size that we have occrding to our compiler.,., > > NOW -- we go and write a App to read this in DevCpp and we have the same > structure BUT > DevCpp (or the gcc or mingW) has a different value of the sizeof() so it > will end up as follows > we read the file in > > fread(&oHeader,sizeof(oHeader),1,infile); > > and we expect the result to look the same. BUT the sizeof this program > returned 24 forinstance and > we will start reading the beginning of the next entry of the second > structure... > > Now this will make my example more true.. > > I hope I understand this incorrect and that somebody can please explain > this problem to me in more detail... You understand correct: it is almost always a bad idea to do something like fread(&oHeader,sizeof(oHeader),1,infile); // bad ! If you want to store data into a file, and there is any chance this file might be read by another application, or the same application, but in a different compile, don't do this. Use an existing file format, or create your own instead. It should exactly specify how the data are stored. Then both applications for reading and writing can look at the specifications and read/write it accordingly. If you still want to use fread/fwrite, try using this with gcc, as i explained in a previous mail: __attribute__((packed)) Elias Pschernig |
|
From: Ioannis V. <no...@ya...> - 2001-07-04 13:22:32
|
Myself would like also at least a primitive RAD... 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 Johannes Pretorius Sent: Wednesday, July 04, 2001 7:35 AM To: dev...@li... Subject: Re: [Dev-C++] Function names in a tree window??? not that I will have an answer but If I can support this Idea also. I think it will be kinda nice to have and good for quick reverence.. Hmm.. Thanks Johannes At 19:57 03/07/2001 +0200, you wrote: >Hi all, > >Firstly, sorry if I repeat many times seen question. >I have following question concerning to Bloodshed Dev-C++ IDE: > >Are there or are planned features in IDE like (now I am not sure about=20 >the >terminology) "the names of the functions appearing in a tree window" and >also something like class inspector (classes and their members in a >hierarchical-like tree) when in 'C++ mode'??? > >Thanks for help, > Brano > > > > >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >http://lists.sourceforge.net/lists/listinfo/dev-cpp-users _______________________________________________ Dev-cpp-users mailing list Dev...@li... http://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Ioannis V. <no...@ya...> - 2001-07-04 13:17:27
|
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Johannes
Pretorius
Sent: Wednesday, July 04, 2001 7:08 AM
To: dev...@li...
Cc: dev...@li...
Subject: Fwd: RE: [Dev-C++] [Dev-C++]: Errors in structures
>
>Please for give if I am incorrect but does a union not allocate the=20
>memory
>space
>of the biggest type inside it. for instace in your example the biggest=20
>type is the Align (I think) so the whole
>union will be that size. Note that a union enables varaibles to share a
I had ommitted a line. Also i will put all he comments and say some
lines of the book.
The code is:
typedef long Align /* For allignment att the limits of long */
union header /* The header of the block */
{
struct
{
union header *ptr; /* next block if it is in the list */
unsigned size; /* size of the block
}s;
Align x; /* Imposition of the allignment of blocks */
};
typedef union header Header;
"A free block contains one pointer to the next block of the chain, one
record for the size of the block, and then the free space itself. The
information for control at the beginning, is called "header". For the
allignment to be simplified, all blocks are multiples of the header
size, and the header is properly alligned. This is achieved with one
union which contains the desired structure of the header and one case of
the most restrictive type of alignment, which we have chosen here
arbitrarily as long".
Also it has a graphic showing some stuff.
------------> points at the next free block
|
----------------------------------
| | | |
| | size| |
----------------------------------
|
------------> The address returned to user (in the book
from malloc()).
So the memory used for non built in types are multiples of these blocks.
If anyone knows more i would be happy to learn what he knows....
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
* Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ya...> - 2001-07-04 12:51:01
|
Now if i understood correctly this is a question for me. Yes a union occupies the space of its biggest member, that's why the minimum size of a struct is a multiple of the sizeof() this union. Of course this was a simplified implementation detail and details in memory management differ in every implementation. That was about my last posting concerning the sizeof a structure. 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 Johannes Pretorius Sent: Wednesday, July 04, 2001 7:08 AM To: dev...@li... Cc: dev...@li... Subject: Fwd: RE: [Dev-C++] [Dev-C++]: Errors in structures >Date: Tue, 03 Jul 2001 14:46:07 +0200 >To: dev...@li... >From: Johannes Pretorius <joh...@pr...> >Subject: RE: [Dev-C++] [Dev-C++]: Errors in structures >Cc: dev...@li... >Bcc: dev...@li... > >Please for give if I am incorrect but does a union not allocate the=20 >memory >space >of the biggest type inside it. for instace in your example the biggest=20 >type is the Align (I think) so the whole >union will be that size. Note that a union enables varaibles to share a >memory block. and the last one used has writen into that >memory block .. IF I am correct , changes are I am understanding this wrong. > >If so the problem still persist that the sizeof() property that is=20 >suppose >to give >you a result of the memory size that is take up for the variable is not >correct, AND if this >value is used in READING a file for instance.. This will result that if a=20 >file was writen in a diffent program >by a different compiler. You will not read the exact amount of bytes into=20 >your structure to corrosponde to >your structure. Meaning you dont have the correct values in. > >Example : >A file header writen in MSVC looks as follows in the start of the file >(note comments in [] are not in file) >[START OF FILE]34^^^^^^^^[8 BYTES]Hallo world^^^^^[16 BYTES]1[1 BYTES]0[1=20 >BYTES] > >The structure for this file looks something like (not correct maybe but >this is just to give the Idea out) > >struct header{ > int version; > char comment[16]; > char code; > char sub_code; >}oHeader; > >Now if this is writen to the File we do it as > >fwrite(&oHeader,sizeof(oHeader),1,outfile); > >Meaning the size that we have occrding to our compiler.,., > >NOW -- we go and write a App to read this in DevCpp and we have the=20 >same >structure BUT >DevCpp (or the gcc or mingW) has a different value of the sizeof() so it=20 >will end up as follows > >we read the file in > >fread(&oHeader,sizeof(oHeader),1,infile); > >and we expect the result to look the same. BUT the sizeof this program >returned 24 forinstance and > >This will result in the past that the LAST byte wont be read..or wont=20 >be >read into the correct value >considering that this is the same (almost ) as doing a memcpy from the=20 >file to the structure memory alocation.. > >Please help me or correct me if I cam wrong.. > >I hope I am wrong and misunderstand this.. >I do believe the packed solution may help us here., > > >Thanks for All your help > >Johannes > > > > > >At 14:29 03/07/2001 +0200, you wrote: >>This is not an error. A structure's space in memory is not the summary >>of the sizeof() of everyone of its members. It may occupy more memory=20 >>due to compiler's memory management technique. For more information=20 >>read section 8.7 in K&R 2. For example a compiler's memory management=20 >>can be a connected list of structs (compilers, operating systems=20 >>e.t.c. are written in C/C++ too). So in the example of K&R it has a=20 >>list of unions connected structs: >> >>typedef long Align; >> >>union header >>{ >> struct >> { >> union header *ptr; /* points to next block */ >> unsigned size; >> }s; >> >> Align x; >>}; >> >>typedef union header Header; >> >> >>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 Jeethu >>Rao >>Sent: Tuesday, July 03, 2001 5:52 AM >>To: Dev CPP Mailing List >>Subject: [Dev-C++] [Dev-C++]: Errors in structures >> >> >>Hi, >> >>I've noticed this strange little Bug.I'm not certain weather its a bug >>or a feature. >> >>The size of this structure is actually 13 bytes. >> >>But sizeof(header) says its 16. >> >>struct tea_hdr >> { >> char jte[3]; >> unsigned char version; >> DWORD infile_size; >> DWORD infile_crc; >> unsigned char fname_sz; >> }header; >> >>No, if I comment out the fname_sz member, >> >>struct tea_hdr >> { >> char jte[3]; >> unsigned char version; >> DWORD infile_size; >> DWORD infile_crc; >> //unsigned char fname_sz; >> }header; >> >>sizeof(header) returns 12. >> >>Is the compiler trying to align structure on DWORD boundaries? >> >>How do I get rid of this Bug/Feature ? >> >>Thnx, >>Jeethu Rao >> >> >>_______________________________________________ >>Dev-cpp-users mailing list Dev...@li... >>http://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> >> >>_______________________________________________ >>Dev-cpp-users mailing list Dev...@li... >>http://lists.sourceforge.net/lists/listinfo/dev-cpp-users _______________________________________________ Dev-cpp-users mailing list Dev...@li... http://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Elias P. <eli...@ao...> - 2001-07-04 10:27:00
|
> > Did you use the right patch for your OS ? > > http://sourceforge.net/project/showfiles.php?group_id=2435&release_id=38543 > > There is only one (sort of) package for the Win9x family. > I even tried to install only the gcc package (and not the recent > binutils) but I get the same error. > Unfortunately I don't know if g++ or Dev-C++ generates the error > message. > Try this: gcc-2.95.3-20010613-W95patch.tar.gz Unzip it into the same foler as mingw-1.0-20010608.tar.gz, overwriting files already there. Be sure not to use the dev-c++ directory, but use a new directory (where you only install these 2 zips) - and just alter the pathes. Hope it works, Elias Pschernig |
|
From: <jar...@ig...> - 2001-07-04 08:20:11
|
On 3 Jul, Elias Pschernig wrote: >> I've tried (naively) to unpack the recent >> mingw-1.0-20010608.tar.gz >> package into the Dev-C++ directory >> since I need gcc-2.95.3 >> Unfortunately, now g++ produces an >> error message: can't exec >> C:/DEV-C_~/BIN/cpp0.exe >> >> Even if I copy cpp0.exe from >> lib/gcc-lib/mingw32/2-93-3.4 >> into Dev-C++/Bin >> I get this message. >> >> What's going wrong? > > Did you use the right patch for your OS ? > http://sourceforge.net/project/showfiles.php?group_id=2435&release_id=38543 There is only one (sort of) package for the Win9x family. I even tried to install only the gcc package (and not the recent binutils) but I get the same error. Unfortunately I don't know if g++ or Dev-C++ generates the error message. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik Institute of Technology, RWTH Aachen D 52056 Aachen, Germany |
|
From: Johannes P. <joh...@pr...> - 2001-07-04 05:24:06
|
not that I will have an answer but If I can support this Idea also. I think it will be kinda nice to have and good for quick reverence.. Hmm.. Thanks Johannes At 19:57 03/07/2001 +0200, you wrote: >Hi all, > >Firstly, sorry if I repeat many times seen question. >I have following question concerning to Bloodshed Dev-C++ IDE: > >Are there or are planned features in IDE like (now I am not sure about the >terminology) "the names of the functions appearing in a tree window" and >also something like class inspector (classes and their members in a >hierarchical-like tree) when in 'C++ mode'??? > >Thanks for help, > Brano > > > > >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >http://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Johannes P. <joh...@pr...> - 2001-07-04 05:22:23
|
I realize now that my example with the 24 bytes is correct for it is 24
bytes. But if you remove the sub_code from the structure and
have two entries of the structure in a binary file forinstance.. like
[START OF FILE]34^^^^^^^^[8 BYTES]Hallo world^^^^^[16 BYTES]1[1 BYTES]0[1
BYTES][START OF 2 STRUC]34^^^^^^^^[8 BYTES]Hallo world^^^^^[16 BYTES]1[1
BYTES]0[1 BYTES]
The structure for this file looks something like (not correct maybe but
this is just to give the Idea out)
struct header{
int version;
char comment[16];
char code;
}oHeader;
Now if this is writen to the File we do it as
fwrite(&oHeader,sizeof(oHeader),1,outfile);
Meaning the size that we have occrding to our compiler.,.,
NOW -- we go and write a App to read this in DevCpp and we have the same
structure BUT
DevCpp (or the gcc or mingW) has a different value of the sizeof() so it
will end up as follows
we read the file in
fread(&oHeader,sizeof(oHeader),1,infile);
and we expect the result to look the same. BUT the sizeof this program
returned 24 forinstance and
we will start reading the beginning of the next entry of the second
structure...
Now this will make my example more true..
I hope I understand this incorrect and that somebody can please explain
this problem to me in more detail...
Thanks
Johannes
At 07:08 04/07/2001 +0200, you wrote:
>>Date: Tue, 03 Jul 2001 14:46:07 +0200
>>To: dev...@li...
>>From: Johannes Pretorius <joh...@pr...>
>>Subject: RE: [Dev-C++] [Dev-C++]: Errors in structures
>>Cc: dev...@li...
>>Bcc: dev...@li...
>>
>>Please for give if I am incorrect but does a union not allocate the
>>memory space
>>of the biggest type inside it. for instace in your example the biggest
>>type is the Align (I think) so the whole
>>union will be that size. Note that a union enables varaibles to share a
>>memory block. and the last one used has writen into that
>>memory block .. IF I am correct , changes are I am understanding this wrong.
>>
>>If so the problem still persist that the sizeof() property that is
>>suppose to give
>>you a result of the memory size that is take up for the variable is not
>>correct, AND if this
>>value is used in READING a file for instance.. This will result that if a
>>file was writen in a diffent program
>>by a different compiler. You will not read the exact amount of bytes into
>>your structure to corrosponde to
>>your structure. Meaning you dont have the correct values in.
>>
>>Example :
>>A file header writen in MSVC looks as follows in the start of the file
>>(note comments in [] are not in file)
>>[START OF FILE]34^^^^^^^^[8 BYTES]Hallo world^^^^^[16 BYTES]1[1 BYTES]0[1
>>BYTES]
>>
>>The structure for this file looks something like (not correct maybe but
>>this is just to give the Idea out)
>>
>>struct header{
>> int version;
>> char comment[16];
>> char code;
>> char sub_code;
>>}oHeader;
>>
>>Now if this is writen to the File we do it as
>>
>>fwrite(&oHeader,sizeof(oHeader),1,outfile);
>>
>>Meaning the size that we have occrding to our compiler.,.,
>>
>>NOW -- we go and write a App to read this in DevCpp and we have the same
>>structure BUT
>>DevCpp (or the gcc or mingW) has a different value of the sizeof() so it
>>will end up as follows
>>
>>we read the file in
>>
>>fread(&oHeader,sizeof(oHeader),1,infile);
>>
>>and we expect the result to look the same. BUT the sizeof this program
>>returned 24 forinstance and
>>
>>This will result in the past that the LAST byte wont be read..or wont be
>>read into the correct value
>>considering that this is the same (almost ) as doing a memcpy from the
>>file to the structure memory alocation..
>>
>>Please help me or correct me if I cam wrong..
>>
>>I hope I am wrong and misunderstand this..
>>I do believe the packed solution may help us here.,
>>
>>
>>Thanks for All your help
>>
>>Johannes
>>
>>
>>
>>
>>
>>At 14:29 03/07/2001 +0200, you wrote:
>>>This is not an error. A structure's space in memory is not the summary
>>>of the sizeof() of everyone of its members. It may occupy more memory
>>>due to compiler's memory management technique. For more information read
>>>section 8.7 in K&R 2. For example a compiler's memory management can be
>>>a connected list of structs (compilers, operating systems e.t.c. are
>>>written in C/C++ too). So in the example of K&R it has a list of unions
>>>connected structs:
>>>
>>>typedef long Align;
>>>
>>>union header
>>>{
>>> struct
>>> {
>>> union header *ptr; /* points to next block */
>>> unsigned size;
>>> }s;
>>>
>>> Align x;
>>>};
>>>
>>>typedef union header Header;
>>>
>>>
>>>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 Jeethu
>>>Rao
>>>Sent: Tuesday, July 03, 2001 5:52 AM
>>>To: Dev CPP Mailing List
>>>Subject: [Dev-C++] [Dev-C++]: Errors in structures
>>>
>>>
>>>Hi,
>>>
>>>I've noticed this strange little Bug.I'm not certain weather its a bug
>>>or a feature.
>>>
>>>The size of this structure is actually 13 bytes.
>>>
>>>But sizeof(header) says its 16.
>>>
>>>struct tea_hdr
>>> {
>>> char jte[3];
>>> unsigned char version;
>>> DWORD infile_size;
>>> DWORD infile_crc;
>>> unsigned char fname_sz;
>>> }header;
>>>
>>>No, if I comment out the fname_sz member,
>>>
>>>struct tea_hdr
>>> {
>>> char jte[3];
>>> unsigned char version;
>>> DWORD infile_size;
>>> DWORD infile_crc;
>>> //unsigned char fname_sz;
>>> }header;
>>>
>>>sizeof(header) returns 12.
>>>
>>>Is the compiler trying to align structure on DWORD boundaries?
>>>
>>>How do I get rid of this Bug/Feature ?
>>>
>>>Thnx,
>>>Jeethu Rao
>>>
>>>
>>>_______________________________________________
>>>Dev-cpp-users mailing list
>>>Dev...@li...
>>>http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>>>
>>>
>>>_______________________________________________
>>>Dev-cpp-users mailing list
>>>Dev...@li...
>>>http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: Johannes P. <joh...@pr...> - 2001-07-04 04:57:29
|
>Date: Tue, 03 Jul 2001 14:46:07 +0200
>To: dev...@li...
>From: Johannes Pretorius <joh...@pr...>
>Subject: RE: [Dev-C++] [Dev-C++]: Errors in structures
>Cc: dev...@li...
>Bcc: dev...@li...
>
>Please for give if I am incorrect but does a union not allocate the memory
>space
>of the biggest type inside it. for instace in your example the biggest
>type is the Align (I think) so the whole
>union will be that size. Note that a union enables varaibles to share a
>memory block. and the last one used has writen into that
>memory block .. IF I am correct , changes are I am understanding this wrong.
>
>If so the problem still persist that the sizeof() property that is suppose
>to give
>you a result of the memory size that is take up for the variable is not
>correct, AND if this
>value is used in READING a file for instance.. This will result that if a
>file was writen in a diffent program
>by a different compiler. You will not read the exact amount of bytes into
>your structure to corrosponde to
>your structure. Meaning you dont have the correct values in.
>
>Example :
>A file header writen in MSVC looks as follows in the start of the file
>(note comments in [] are not in file)
>[START OF FILE]34^^^^^^^^[8 BYTES]Hallo world^^^^^[16 BYTES]1[1 BYTES]0[1
>BYTES]
>
>The structure for this file looks something like (not correct maybe but
>this is just to give the Idea out)
>
>struct header{
> int version;
> char comment[16];
> char code;
> char sub_code;
>}oHeader;
>
>Now if this is writen to the File we do it as
>
>fwrite(&oHeader,sizeof(oHeader),1,outfile);
>
>Meaning the size that we have occrding to our compiler.,.,
>
>NOW -- we go and write a App to read this in DevCpp and we have the same
>structure BUT
>DevCpp (or the gcc or mingW) has a different value of the sizeof() so it
>will end up as follows
>
>we read the file in
>
>fread(&oHeader,sizeof(oHeader),1,infile);
>
>and we expect the result to look the same. BUT the sizeof this program
>returned 24 forinstance and
>
>This will result in the past that the LAST byte wont be read..or wont be
>read into the correct value
>considering that this is the same (almost ) as doing a memcpy from the
>file to the structure memory alocation..
>
>Please help me or correct me if I cam wrong..
>
>I hope I am wrong and misunderstand this..
>I do believe the packed solution may help us here.,
>
>
>Thanks for All your help
>
>Johannes
>
>
>
>
>
>At 14:29 03/07/2001 +0200, you wrote:
>>This is not an error. A structure's space in memory is not the summary
>>of the sizeof() of everyone of its members. It may occupy more memory
>>due to compiler's memory management technique. For more information read
>>section 8.7 in K&R 2. For example a compiler's memory management can be
>>a connected list of structs (compilers, operating systems e.t.c. are
>>written in C/C++ too). So in the example of K&R it has a list of unions
>>connected structs:
>>
>>typedef long Align;
>>
>>union header
>>{
>> struct
>> {
>> union header *ptr; /* points to next block */
>> unsigned size;
>> }s;
>>
>> Align x;
>>};
>>
>>typedef union header Header;
>>
>>
>>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 Jeethu
>>Rao
>>Sent: Tuesday, July 03, 2001 5:52 AM
>>To: Dev CPP Mailing List
>>Subject: [Dev-C++] [Dev-C++]: Errors in structures
>>
>>
>>Hi,
>>
>>I've noticed this strange little Bug.I'm not certain weather its a bug
>>or a feature.
>>
>>The size of this structure is actually 13 bytes.
>>
>>But sizeof(header) says its 16.
>>
>>struct tea_hdr
>> {
>> char jte[3];
>> unsigned char version;
>> DWORD infile_size;
>> DWORD infile_crc;
>> unsigned char fname_sz;
>> }header;
>>
>>No, if I comment out the fname_sz member,
>>
>>struct tea_hdr
>> {
>> char jte[3];
>> unsigned char version;
>> DWORD infile_size;
>> DWORD infile_crc;
>> //unsigned char fname_sz;
>> }header;
>>
>>sizeof(header) returns 12.
>>
>>Is the compiler trying to align structure on DWORD boundaries?
>>
>>How do I get rid of this Bug/Feature ?
>>
>>Thnx,
>>Jeethu Rao
>>
>>
>>_______________________________________________
>>Dev-cpp-users mailing list
>>Dev...@li...
>>http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>>
>>
>>_______________________________________________
>>Dev-cpp-users mailing list
>>Dev...@li...
>>http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: <KL...@ao...> - 2001-07-04 04:37:17
|
Thanks for coming to my aide, it is really appreciated, in the meantime I was able to solve my problem and I did get the satisfaction of running the program correctly, so now I'm moving on to the next program and I'm confident I'll have the same success, but If and when I need help I'll be comin' a runnin' to get your advise. thanks again kent |
|
From: Charles <cha...@at...> - 2001-07-03 23:57:23
|
Luigi - > - I'am working with Win98, "hello" was compiled by Dev C++ version 4 - and I have Cygnus Insight Debugger version 5 (help-about says: this GDB was configured as "i686-pc-cygwin") That is the same as my installation (except that I am running Windows 95). The "i686..." part is what you should have. > >What happens when you enter RUN in the console window? > - the program "hello" executes as expected (strange isn't it ?!) Yes, that is exactly what was happening to me... >>>Argument required (target name) try 'help target' ...until I actually read the 'help target' section of the online documentation. That led me to the... >Verify that the Target is set to EXEC in the Target Selection area ... > the target was initially blank, but selecting EXEC is of no help. At this point our paths diverge. Try selecting EXEC again. Once I did that the RUN icon in the Source Windows works every time. What is strange is that if I go back to select EXEC the window is blank! I would think that EXEC should always appear there until set to some other value. I think that's a bug. Perhaps there's some small feature that is different between our setups. Before I found the EXEC help suggestion I always had to type RUN into the Console Window. It was very cumbersome. Perhaps you're stuck with that option until the next revision of the software. Chuck |
|
From: Luigi S. <gi...@li...> - 2001-07-03 23:08:42
|
Hello Chuck -
First of all: thank you for answering.
I did not solve the problem yet.
Here are the answers to your questions.
To begin with, this is the code that I'm debugging:
hello.cpp
---
#include<iostream>
int
main()
{
cout << "hello world\n";
return 0;
}
---
At 10.26 01/07/01 -0700, you wrote:
>Luigi -
>....
>
>First be sure that you have downloaded the Insight version 5 debugger ...
- I'am working with Win98, "hello" was compiled by Dev C++ version 4 - and
I have Cygnus Insight Debugger version 5 (help-about says: this GDB was
configured as "i686-pc-cygwin")
>What message do you get in the Console Window when that happens?
- I get no message in the console window when I start the debugger, but when
I start the program "hello" from the source window, the console window says:
Argument required (target name) try 'help target'
Breakpoint 1, main() at //c/hello/hello.cpp:6
Of course at this point the program is hanged and the only thing I can do
is kill the source window (which kills the debugger).
>What happens when you enter RUN in the console window?
- the program "hello" executes as expected (strange isn't it ?!)
>Verify that the
>Target is set to EXEC in the Target Selection area ...
the target was initially blank, but selecting EXEC is of no help.
--
gisan
|
|
From: Vassili <v.v...@bt...> - 2001-07-03 18:17:56
|
This is due to the compiler aligning members at addresses that are multiples
of 8 bytes. You'll find the something happens if you use classes.
----- Original Message -----
From: "Elias Pschernig" <eli...@ao...>
To: <dev...@li...>
Sent: Tuesday, July 03, 2001 12:07 PM
Subject: Re: [Dev-C++] [Dev-C++]: Errors in structures
> > It is not a bug, it is compiler feature. For some optimizations some c++
> > compilers adjust the size of structue to the multiple of 8.
> >
>
> I think it is only a multiple of 4. The reason is that the compiler you
are
> using is for a 32bit processor. You will find the same thing on any other
> compiler which outputs 32bit object code as well. (A 64bit processor
> probably will use 8 byte.) The reason for this is, for a 32-processor the
> memory is just a block of 32 bit long units, and 32 bits are 4 bytes. So
> every variable (even structs) should start on a 4 bytes boundary. That's
> why they have to be aligned to the length of a multiple of 4 bytes.
>
> To turn the alignment of structs off in mingw, try this (the code will
> not be portable anymore then though, because if you compile with another
> compiler like MSVC, it won't recognize it):
>
> struct mystruct {
> char a;
> int b;
> } __attribute__((packed)) c;
>
> sizeof(c) should now be 5, one char (1) and one int (4).
>
> Regards,
>
> Elias Pschernig
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: Brano T. <ti...@sj...> - 2001-07-03 17:59:23
|
Hi all,
Firstly, sorry if I repeat many times seen question.
I have following question concerning to Bloodshed Dev-C++ IDE:
Are there or are planned features in IDE like (now I am not sure about the
terminology) "the names of the functions appearing in a tree window" and
also something like class inspector (classes and their members in a
hierarchical-like tree) when in 'C++ mode'???
Thanks for help,
Brano
|
|
From: Yoshiaki G. <yos...@re...> - 2001-07-03 12:53:32
|
Thanks! It works well. Elias Pschernig wrote: > > Hello, > > I am very new to Dev-C++. > > Now, I am creating Win32 application using Dev-C++ and want to use > > common control such as toolbar. > > When I compile the project, linker says "g++: comctl32.lib: No such file > > or directory". > > I set compiler option to "-l comctl32.lib" in project options and add > > library pathes. > > However, it does not work. > > > > How can I link the library? > > > > Not "-l comctl32.lib", but "-lcomctl32". > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Elias P. <eli...@ao...> - 2001-07-03 12:36:53
|
> Hello, > I am very new to Dev-C++. > Now, I am creating Win32 application using Dev-C++ and want to use > common control such as toolbar. > When I compile the project, linker says "g++: comctl32.lib: No such file > or directory". > I set compiler option to "-l comctl32.lib" in project options and add > library pathes. > However, it does not work. > > How can I link the library? > Not "-l comctl32.lib", but "-lcomctl32". |
|
From: Elias P. <eli...@ao...> - 2001-07-03 12:34:47
|
> I've tried (naively) to unpack the recent > mingw-1.0-20010608.tar.gz > package into the Dev-C++ directory > since I need gcc-2.95.3 > Unfortunately, now g++ produces an > error message: can't exec > C:/DEV-C_~/BIN/cpp0.exe > > Even if I copy cpp0.exe from > lib/gcc-lib/mingw32/2-93-3.4 > into Dev-C++/Bin > I get this message. > > What's going wrong? Did you use the right patch for your OS ? http://sourceforge.net/project/showfiles.php?group_id=2435&release_id=38543 |