dev-cpp-users Mailing List for Dev-C++ (Page 2)
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
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
1
(2) |
2
|
3
|
4
|
5
(4) |
6
(2) |
7
(5) |
8
(4) |
9
|
10
|
11
(10) |
12
(1) |
13
|
14
|
15
|
16
|
17
|
18
|
19
(7) |
20
(2) |
21
|
22
(3) |
23
|
24
|
25
|
26
(2) |
27
|
28
(1) |
29
|
30
|
From: Akua A. <ek...@sb...> - 2007-06-11 06:13:30
|
Hello, Does anyone know how to create resource script files and link these to source programs? I created a Resource (.rc) file using WinAPI. I then created a header file and my c-source code. I put my header file, which contained definitions into the header region of my .rc file. I also put the header file in my c-source code file. Next, I pressed compile and tried to link all of it together. However, I got an error, it said that the resource file could not be found. It opened up a separate file which actually contained no information at all. Can someone with experience usin the DEV C++ IDE teach me how to create a project with these component files? Thanks. dev...@li... wrote: Send Dev-cpp-users mailing list submissions to dev...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/dev-cpp-users or, via email, send a message with subject or body 'help' to dev...@li... You can reach the person managing the list at dev...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Dev-cpp-users digest..." Today's Topics: 1. What is wrong (Jan Mura) 2. Re: What is wrong (Per Westermark) 3. Re: What is wrong (Jan Mura) 4. Formula question (Philip Bennefall) 5. Re: Formula question (Jonathan Winterflood) 6. Re: Formula question (Per Westermark) 7. Re: Formula question (Per Westermark) 8. Linked list (Jan Mura) ---------------------------------------------------------------------- Message: 1 Date: Wed, 6 Jun 2007 19:08:24 +0200 From: "Jan Mura" Subject: [Dev-C++] What is wrong To: Message-ID: <000701c7a85d$4c763a70$e6e218ac@TERASUS2> Content-Type: text/plain; charset="iso-8859-2" Hello, I would like to ask what is wrong on the following: ... int *i; *i = 1; printf ("%d", *i); ... As I read in Brian W. Kernighan, Denis M. Ritchie it should work. But anyway in my program it prints nothing. If I delete the line *i = 1; it works properly. I am on XP Professional with Dev-Cpp. Thanks Jan Mura jan...@vo... ------------------------------ Message: 2 Date: Wed, 6 Jun 2007 19:13:43 +0200 (CEST) From: Per Westermark Subject: Re: [Dev-C++] What is wrong To: Jan Mura Cc: dev...@li... Message-ID: Content-Type: TEXT/PLAIN; charset=US-ASCII i is a pointer, i'e an address to a separate memory for storing the integer value. You must first assign an address to i, before you may assign an integer to the memory area pointed to by i. int main() { int *i; i = (int*)malloc(sizeof(int)); *i = 1; printf("%d\n",*i); free(i); // release the memory allocated with the malloc() call. return 0; } /pwm On Wed, 6 Jun 2007, Jan Mura wrote: > Hello, > > I would like to ask what is wrong on the following: > > ... > int *i; > *i = 1; > printf ("%d", *i); > > ... > > As I read in > Brian W. Kernighan, Denis M. Ritchie it should work. > > But anyway in my program it prints nothing. > > If I delete the line > > *i = 1; > > it works properly. > > > > I am on XP Professional with Dev-Cpp. > > > > Thanks > > > > Jan Mura > > jan...@vo... > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > ------------------------------ Message: 3 Date: Thu, 7 Jun 2007 08:39:45 +0200 From: "Jan Mura" Subject: Re: [Dev-C++] What is wrong To: Message-ID: <001401c7a8ce$a48a12b0$720c18ac@TERASUS2> Content-Type: text/plain; charset="iso-8859-2" Well, of course. Maybe I am a little bit out of order because of dealing with C and its pointers now quite intensively. Thank you anyway Jan Mura ----- Original Message ----- From: "Per Westermark" To: "Jan Mura" Cc: Sent: Wednesday, June 06, 2007 7:13 PM Subject: Re: [Dev-C++] What is wrong > i is a pointer, i'e an address to a separate memory for storing the > integer value. > > You must first assign an address to i, before you may assign an integer to > the memory area pointed to by i. > > int main() { > int *i; > i = (int*)malloc(sizeof(int)); > *i = 1; > printf("%d\n",*i); > free(i); // release the memory allocated with the malloc() call. > return 0; > } > > /pwm > > On Wed, 6 Jun 2007, Jan Mura wrote: > > > Hello, > > > > I would like to ask what is wrong on the following: > > > > ... > > int *i; > > *i = 1; > > printf ("%d", *i); > > > > ... > > > > As I read in > > Brian W. Kernighan, Denis M. Ritchie it should work. > > > > But anyway in my program it prints nothing. > > > > If I delete the line > > > > *i = 1; > > > > it works properly. > > > > > > > > I am on XP Professional with Dev-Cpp. > > > > > > > > Thanks > > > > > > > > Jan Mura > > > > jan...@vo... > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > __________ Informace od NOD32 2313 (20070606) __________ > > Tato zprava byla proverena antivirovym systemem NOD32. > http://www.nod32.cz > > ------------------------------ Message: 4 Date: Thu, 7 Jun 2007 18:03:30 +0200 From: "Philip Bennefall" Subject: [Dev-C++] Formula question To: Message-ID: <008b01c7a91d$64efc790$4800a8c0@Pbgames> Content-Type: text/plain; charset="iso-8859-1" Hi, Could anyone tell me the formula which is used to calculate the min and max values for a numerical data type of x bytes? Say for instance that I use the sizeof(datatype) function and get the answer 4, which is usually an integer, how do I then programatically calculate the min and max values for a signed and unsigned version of the data type respectively. Thanks in advance. Regards Philip Bennefall -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 5 Date: Thu, 7 Jun 2007 18:55:32 +0200 From: "Jonathan Winterflood" Subject: Re: [Dev-C++] Formula question To: "Philip Bennefall" Cc: dev...@li... Message-ID: Content-Type: text/plain; charset="iso-8859-1" On 6/7/07, Philip Bennefall wrote: > > Hi, > Could anyone tell me the formula which is used to calculate the min and > max values for a numerical data type of x bytes? Say for instance that I use > the > sizeof(datatype) function and get the answer 4, which is usually an > integer, how do I then programatically calculate the min and max values for > a signed > and unsigned version of the data type respectively. > Thanks in advance. > Regards > Philip Bennefall > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > Hi, Usually there are constants defined for this use, which might be more useful. However, this is how to calculate the values, supposing the encoding for negative number is 2's complement (machines that don't use this are rather rare, I believe, and won't be running windows...) Also supposing your data type is some kind of binary integer (floats and double are encoded differently) nb_bytes = sizeof(...) nb_bits = 8*nb_bytes max_unsigned = 2^nb_bits - 1 min_unsigned = 0 //no kidding ! max_signed = 2^(nb_bits-1) - 1 min_unsigned = -( 2^(nb_bits-1) ) Jonathan -- linux, c'est une question de VI ou de MORE -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 6 Date: Thu, 7 Jun 2007 19:09:10 +0200 (CEST) From: Per Westermark Subject: Re: [Dev-C++] Formula question To: Philip Bennefall Cc: dev...@li... Message-ID: Content-Type: TEXT/PLAIN; charset=US-ASCII There are no formula for that. This is the normal way of doing it in C (available in the standard header files) #define MAX(a,b) ((a) >= (b) ? (a) : (b)) #define MIN(a,b) ((a) <= (b) ? (a) : (b)) Note that the above two constructs have problems if the parameters have side effects, i.e. for something like: max = MAX(*a++,*b--); For c++, there is a algorithm std::max() available in the standard template library. /pwm On Thu, 7 Jun 2007, Philip Bennefall wrote: > Hi, > Could anyone tell me the formula which is used to calculate the min and max values for a numerical data type of x bytes? Say for instance that I use the > sizeof(datatype) function and get the answer 4, which is usually an integer, how do I then programatically calculate the min and max values for a signed > and unsigned version of the data type respectively. > > Thanks in advance. > > Regards > Philip Bennefall ------------------------------ Message: 7 Date: Thu, 7 Jun 2007 19:10:58 +0200 (CEST) From: Per Westermark Subject: Re: [Dev-C++] Formula question To: Philip Bennefall Cc: dev...@li... Message-ID: Content-Type: TEXT/PLAIN; charset=US-ASCII Oops, missed the meaning of your question. Look at the file - it contains a lot of defines for numeric ranges for different data types (char, short, int, long, ...) /pwm On Thu, 7 Jun 2007, Philip Bennefall wrote: > Hi, > Could anyone tell me the formula which is used to calculate the min and max values for a numerical data type of x bytes? Say for instance that I use the > sizeof(datatype) function and get the answer 4, which is usually an integer, how do I then programatically calculate the min and max values for a signed > and unsigned version of the data type respectively. > > Thanks in advance. > > Regards > Philip Bennefall ------------------------------ Message: 8 Date: Fri, 8 Jun 2007 16:46:05 +0200 From: "Jan Mura" Subject: [Dev-C++] Linked list To: Message-ID: <000601c7a9db$bff90b10$8ce118ac@TERASUS2> Content-Type: text/plain; charset="iso-8859-2" Hello, I would like to ask about some things in linked list I try to write. It looks like: struct s { int id; char *name; struct s *next; }; int main () { struct s *front = NULL; /*the front of a list */ int i = 1; char *name; while (1) { gets (name); if (strlen(name) == 0) break; in_list (&front, i, name); i++; } return 0; } void in_list (struct s **q, int in_id, const char *in_name) { struct s*member, *temp; member = malloc (sizeof (struct s)); member -> name = malloc (strlen (in_name) +1); member-> id = in_id; strcpy (member -> name, in_name); member -> next = NULL; /* it will be the last member in the list */ if (q == NULL) /* empty list */ { q = member; q -> next = NULL; } else { temp = q; temp -> next = q -> next; while (temp -> next != NULL) temp = temp -> next; /* looking for the last member in the list */ temp ->next = member; /* the last member is no more the last one */ } } Should I allocate the space for temp and temp -> next when I am putting an adress from member to temp? So should it looks like: temp = malloc ...; temp = member; ??? Thanks for your answer. Jan Mura jan...@vo... ------------------------------ ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ------------------------------ _______________________________________________ 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 End of Dev-cpp-users Digest, Vol 13, Issue 2 ******************************************** |
From: Jan M. <jan...@vo...> - 2007-06-08 18:28:35
|
Thank you very much. Now I need to accept all of the hints and suggestions and correction :-) But they are very useful I have to say. Jan Mura jan...@vo... |
From: Per W. <pw...@ia...> - 2007-06-08 17:11:48
|
No need for any extra allocation. You are making an extra assign: temp = q; temp -> next = q -> next; Note that after the first assign, temp and q will have the same value, i.e. point to the same memory. temp->next and q->next is not two different fields. It's the same memory, so the second assign is about as useful as writing: foo = foo; A little trick when working with single-lined lists: Don't make the last element in the list have a next = NULL; Don't keep track of the list with a pointer front. Instead make the list circular, and keep track of the list with a pointer named last or tail. Note that if the list is empty, last will be NULL. If the list is not empty, last->next will point to the first entry in the list. This way, you will be able to access both the first and the last element in the list in constant time. You will also be able to insert new elements either first or last, without the need to loop through the list. /pwm On Fri, 8 Jun 2007, Jan Mura wrote: > Hello, > > I would like to ask about some things in linked list I > try to write. > It looks like: > > struct s > { > int id; > char *name; > struct s *next; > }; > > int main () > { > struct s *front = NULL; /*the front of a list */ > int i = 1; > char *name; > > while (1) > { > gets (name); > if (strlen(name) == 0) break; > in_list (&front, i, name); > i++; > } > return 0; > } > > void in_list (struct s **q, int in_id, const char *in_name) > { > struct s*member, *temp; > > member = malloc (sizeof (struct s)); > member -> name = malloc (strlen (in_name) +1); > > member-> id = in_id; > strcpy (member -> name, in_name); > member -> next = NULL; /* it will be the last member in the list */ > > if (q == NULL) /* empty list */ > { > q = member; > q -> next = NULL; > } > else > { > temp = q; > temp -> next = q -> next; > > while (temp -> next != NULL) > temp = temp -> next; /* looking for the last member in the list */ > > temp ->next = member; /* the last member is no more the last one */ > } > } > > Should I allocate the space for temp and temp -> next when I am > putting an adress from member to temp? > > So should it looks like: > > temp = malloc ...; > temp = member; > ??? > > Thanks for your answer. > > Jan Mura > jan...@vo... > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Jonathan W. <jon...@gm...> - 2007-06-08 17:08:03
|
On 6/8/07, Jan Mura <jan...@vo...> wrote: > > Hello, > > I would like to ask about some things in linked list I > try to write. > It looks like: > > struct s > { > int id; > char *name; > struct s *next; > }; > > int main () > { > struct s *front = NULL; /*the front of a list */ > int i = 1; > char *name; > > while (1) > { > gets (name); > if (strlen(name) == 0) break; > in_list (&front, i, name); > i++; > } > return 0; > } > > void in_list (struct s **q, int in_id, const char *in_name) > { > struct s*member, *temp; > > member = malloc (sizeof (struct s)); > member -> name = malloc (strlen (in_name) +1); > > member-> id = in_id; > strcpy (member -> name, in_name); > member -> next = NULL; /* it will be the last member in the list */ > > if (q == NULL) /* empty list */ > { > q = member; > q -> next = NULL; > } > else > { > temp = q; > temp -> next = q -> next; > > while (temp -> next != NULL) > temp = temp -> next; /* looking for the last member in the list */ > > temp ->next = member; /* the last member is no more the last one */ > } > } > > Should I allocate the space for temp and temp -> next when I am > putting an adress from member to temp? > > So should it looks like: > > temp = malloc ...; > temp = member; > ??? > > Thanks for your answer. > > Jan Mura > jan...@vo... > > Should I allocate the space for temp and temp -> next when I am > putting an adress from member to temp? No, you shouldn't: /temp/ is a local variable that points to something, when you declare /temp/ thus : /struct * temp;/ you are already getting local space to store the pointer, just as if you were declaring an integer (pointers _are_ integers, actually) Your suggestion would allocate some memory, and then immediately lose the pointer to it, losing the memory without even using it. Also, there are a couple of small errors in your code that show: /struct **q/ points to the pointer to the first member, therefore you should use / *q/ instead of /q/ to access the pointer to the first member (basically all your uses of /q/) When you say / *q->next = NULL;/, *q is == member, so / *q->next/ is already NULL Same thing here: /temp -> next = *q -> next;/ :temp and *q point to the same structure, so there's no use doing that Plus, just some hints, if I may: you can avoid using /struct s/ everywhere like this: typedef struct list_element_struct { int id; char *name; struct list_element_struct *next; //you still need struct here becuse the typedef isn't done yet } list_element; and then use /list_element/ instead you might want to write some helper functions such as these: list_element *new_list_element(int id,char*name) // mallocs the element and sets the name void free_list_element(list_element *elem) //frees the name and element void list_append(list_element **list, list_element *elem) // does the appending part (the rest of your in_list) Of course, you can do whatever you want :-D Hope it helps :) Jonathan -- <Morpheus> linux, c'est une question de VI ou de MORE |
From: Jan M. <jan...@vo...> - 2007-06-08 14:45:49
|
Hello, I would like to ask about some things in linked list I try to write. It looks like: struct s { int id; char *name; struct s *next; }; int main () { struct s *front = NULL; /*the front of a list */ int i = 1; char *name; while (1) { gets (name); if (strlen(name) == 0) break; in_list (&front, i, name); i++; } return 0; } void in_list (struct s **q, int in_id, const char *in_name) { struct s*member, *temp; member = malloc (sizeof (struct s)); member -> name = malloc (strlen (in_name) +1); member-> id = in_id; strcpy (member -> name, in_name); member -> next = NULL; /* it will be the last member in the list */ if (q == NULL) /* empty list */ { q = member; q -> next = NULL; } else { temp = q; temp -> next = q -> next; while (temp -> next != NULL) temp = temp -> next; /* looking for the last member in the list */ temp ->next = member; /* the last member is no more the last one */ } } Should I allocate the space for temp and temp -> next when I am putting an adress from member to temp? So should it looks like: temp = malloc ...; temp = member; ??? Thanks for your answer. Jan Mura jan...@vo... |
From: Per W. <pw...@ia...> - 2007-06-07 17:11:23
|
Oops, missed the meaning of your question. Look at the file <limits.h> - it contains a lot of defines for numeric ranges for different data types (char, short, int, long, ...) /pwm On Thu, 7 Jun 2007, Philip Bennefall wrote: > Hi, > Could anyone tell me the formula which is used to calculate the min and max values for a numerical data type of x bytes? Say for instance that I use the > sizeof(datatype) function and get the answer 4, which is usually an integer, how do I then programatically calculate the min and max values for a signed > and unsigned version of the data type respectively. > > Thanks in advance. > > Regards > Philip Bennefall |
From: Per W. <pw...@ia...> - 2007-06-07 17:10:11
|
There are no formula for that. This is the normal way of doing it in C (available in the standard header files) #define MAX(a,b) ((a) >= (b) ? (a) : (b)) #define MIN(a,b) ((a) <= (b) ? (a) : (b)) Note that the above two constructs have problems if the parameters have side effects, i.e. for something like: max = MAX(*a++,*b--); For c++, there is a algorithm std::max() available in the standard template library. /pwm On Thu, 7 Jun 2007, Philip Bennefall wrote: > Hi, > Could anyone tell me the formula which is used to calculate the min and max values for a numerical data type of x bytes? Say for instance that I use the > sizeof(datatype) function and get the answer 4, which is usually an integer, how do I then programatically calculate the min and max values for a signed > and unsigned version of the data type respectively. > > Thanks in advance. > > Regards > Philip Bennefall |
From: Jonathan W. <jon...@gm...> - 2007-06-07 16:55:37
|
On 6/7/07, Philip Bennefall <phi...@pb...> wrote: > > Hi, > Could anyone tell me the formula which is used to calculate the min and > max values for a numerical data type of x bytes? Say for instance that I use > the > sizeof(datatype) function and get the answer 4, which is usually an > integer, how do I then programatically calculate the min and max values for > a signed > and unsigned version of the data type respectively. > Thanks in advance. > Regards > Philip Bennefall > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > Hi, Usually there are constants defined for this use, which might be more useful. However, this is how to calculate the values, supposing the encoding for negative number is 2's complement (machines that don't use this are rather rare, I believe, and won't be running windows...) Also supposing your data type is some kind of binary integer (floats and double are encoded differently) nb_bytes = sizeof(...) nb_bits = 8*nb_bytes max_unsigned = 2^nb_bits - 1 min_unsigned = 0 //no kidding ! max_signed = 2^(nb_bits-1) - 1 min_unsigned = -( 2^(nb_bits-1) ) Jonathan -- <Morpheus> linux, c'est une question de VI ou de MORE |
From: Philip B. <phi...@pb...> - 2007-06-07 16:03:25
|
Hi, Could anyone tell me the formula which is used to calculate the min and = max values for a numerical data type of x bytes? Say for instance that I = use the sizeof(datatype) function and get the answer 4, which is usually an = integer, how do I then programatically calculate the min and max values = for a signed and unsigned version of the data type respectively. Thanks in advance. Regards Philip Bennefall |
From: Jan M. <jan...@vo...> - 2007-06-07 06:39:20
|
Well, of course. Maybe I am a little bit out of order because of dealing with C and its pointers now quite intensively. Thank you anyway Jan Mura ----- Original Message ----- From: "Per Westermark" <pw...@ia...> To: "Jan Mura" <jan...@vo...> Cc: <dev...@li...> Sent: Wednesday, June 06, 2007 7:13 PM Subject: Re: [Dev-C++] What is wrong > i is a pointer, i'e an address to a separate memory for storing the > integer value. > > You must first assign an address to i, before you may assign an integer to > the memory area pointed to by i. > > int main() { > int *i; > i = (int*)malloc(sizeof(int)); > *i = 1; > printf("%d\n",*i); > free(i); // release the memory allocated with the malloc() call. > return 0; > } > > /pwm > > On Wed, 6 Jun 2007, Jan Mura wrote: > > > Hello, > > > > I would like to ask what is wrong on the following: > > > > ... > > int *i; > > *i = 1; > > printf ("%d", *i); > > > > ... > > > > As I read in > > Brian W. Kernighan, Denis M. Ritchie it should work. > > > > But anyway in my program it prints nothing. > > > > If I delete the line > > > > *i = 1; > > > > it works properly. > > > > > > > > I am on XP Professional with Dev-Cpp. > > > > > > > > Thanks > > > > > > > > Jan Mura > > > > jan...@vo... > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > __________ Informace od NOD32 2313 (20070606) __________ > > Tato zprava byla proverena antivirovym systemem NOD32. > http://www.nod32.cz > > |
From: Per W. <pw...@ia...> - 2007-06-06 17:14:39
|
i is a pointer, i'e an address to a separate memory for storing the integer value. You must first assign an address to i, before you may assign an integer to the memory area pointed to by i. int main() { int *i; i = (int*)malloc(sizeof(int)); *i = 1; printf("%d\n",*i); free(i); // release the memory allocated with the malloc() call. return 0; } /pwm On Wed, 6 Jun 2007, Jan Mura wrote: > Hello, > > I would like to ask what is wrong on the following: > > ... > int *i; > *i = 1; > printf ("%d", *i); > > ... > > As I read in > Brian W. Kernighan, Denis M. Ritchie it should work. > > But anyway in my program it prints nothing. > > If I delete the line > > *i = 1; > > it works properly. > > > > I am on XP Professional with Dev-Cpp. > > > > Thanks > > > > Jan Mura > > jan...@vo... > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Jan M. <jan...@vo...> - 2007-06-06 17:08:15
|
Hello, I would like to ask what is wrong on the following: ... int *i; *i = 1; printf ("%d", *i); ... As I read in Brian W. Kernighan, Denis M. Ritchie it should work. But anyway in my program it prints nothing. If I delete the line *i = 1; it works properly. I am on XP Professional with Dev-Cpp. Thanks Jan Mura jan...@vo... |
From: MOHAMMED S. <chi...@ya...> - 2007-06-05 15:18:50
|
Hi Everyone, I need help regarding writing c++ application that either starts up when windows is started or runs at the background whiles windows runs using the Dev-C++ ide. dev...@li... wrote: Send Dev-cpp-users mailing list submissions to dev...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/dev-cpp-users or, via email, send a message with subject or body 'help' to dev...@li... You can reach the person managing the list at dev...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Dev-cpp-users digest..." Today's Topics: 1. (no subject) (hhh hhh) 2. Re: (no subject) (Rory Walsh) 3. Re: (no subject) (Jonathan Winterflood) 4. Compile library - linking error (warbad celvinc) 5. Gettimeofday in dev-c++ (barreto) 6. Re: Gettimeofday in dev-c++ (Per Westermark) 7. Re: Dev-cpp-users Digest, Vol 12, Issue 11 (MOHAMMED SEIDU) ---------------------------------------------------------------------- Message: 1 Date: Sun, 27 May 2007 10:56:05 +0000 From: "hhh hhh" Subject: [Dev-C++] (no subject) To: dev...@li... Message-ID: Content-Type: text/plain; charset=iso-8859-1; format=flowed Estimeed dev...@li... : Hi people... I was hoping that you could point me some guidance. I want to write a little app that captures images and video from my web cam, but i can't seem to find any useful sources, as they are all strangely written, like private use code. So, if u please could help me out, I would be very much appreciated _________________________________________________________________ Fazer um telefonema para o PC de um amigo n?o custa nada. ? gr?tis! http://get.live.com/pt-pt/messenger/overview ------------------------------ Message: 2 Date: Sun, 27 May 2007 18:08:33 +0100 From: Rory Walsh Subject: Re: [Dev-C++] (no subject) To: hhh hhh Cc: dev...@li... Message-ID: <465...@ea...> Content-Type: text/plain; charset=ISO-8859-1; format=flowed I have done this using the windows API but it was a long time ago and that code is long gone. Try doing a search for 'Video Capture Functions win32' in google and you should find plenty of useful info. You could also try using directx which also has certain functions to capturing video. Best of luck with it. Rory. hhh hhh wrote: > Estimeed dev...@li... : > > Hi people... I was hoping that you could point me some guidance. I want to > write a little app that captures images and video from my web cam, but i > can't seem to find any useful sources, as they are all strangely written, > like private use code. > So, if u please could help me out, I would be very much appreciated > > _________________________________________________________________ > Fazer um telefonema para o PC de um amigo n?o custa nada. ? gr?tis! > http://get.live.com/pt-pt/messenger/overview > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > ------------------------------ Message: 3 Date: Sun, 27 May 2007 19:22:16 +0200 From: "Jonathan Winterflood" Subject: Re: [Dev-C++] (no subject) To: "Rory Walsh" Cc: dev...@li..., hhh hhh Message-ID: Content-Type: text/plain; charset="iso-8859-1" You could try looking into the Virtualdub capture mode code: it supports windows' video capture interface. http://www.virtualdub.org Jonathan On 5/27/07, Rory Walsh wrote: > > I have done this using the windows API but it was a long time ago and > that code is long gone. Try doing a search for 'Video Capture Functions > win32' in google and you should find plenty of useful info. You could > also try using directx which also has certain functions to capturing > video. Best of luck with it. > > Rory. > > hhh hhh wrote: > > Estimeed dev...@li... : > > > > Hi people... I was hoping that you could point me some guidance. I > want to > > write a little app that captures images and video from my web cam, but i > > can't seem to find any useful sources, as they are all strangely > written, > > like private use code. > > So, if u please could help me out, I would be very much appreciated > > > > _________________________________________________________________ > > Fazer um telefonema para o PC de um amigo n?o custa nada. ? gr?tis! > > http://get.live.com/pt-pt/messenger/overview > > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > -- linux, c'est une question de VI ou de MORE -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 4 Date: Tue, 29 May 2007 22:24:26 +0000 (GMT) From: warbad celvinc Subject: [Dev-C++] Compile library - linking error To: dev...@li... Message-ID: <470...@we...> Content-Type: text/plain; charset=ascii Hello all, I'm currently trying to compile a library from my own, with actually only one function which call a system call (the rest of the files are not shown here): DLLIMPORT void DumpNetConnection (void) { LPHANDLE net; WnetOpenEnum(RESOURCE_CONNECTED, RESOURCETYPE_ANY, 0, NULL, net); return; } However, i have the follwing error at compile time : dllwrap.exe --output-def libMyLib.def --implib libMyLib.a dllmain.o -L"C:/Dev-Cpp/lib" --no-export-all-symbols --add-stdcall-alias C:/Dev-Cpp/lib/libmpr.a -g3 -o MyLib.dll dllmain.o(.text+0x2d): In function `DumpNetConnection': D:/sources/MyLib/dllmain.c:13: undefined reference to `WnetOpenEnum' What goes wrong ? I linked to the correct library in project parameter. Thank's for any help. _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail ------------------------------ Message: 5 Date: Wed, 30 May 2007 17:52:44 -0300 From: "barreto" Subject: [Dev-C++] Gettimeofday in dev-c++ To: Message-ID: <00aa01c7a2fc$788c08d0$17040a0a@LAPDELL> Content-Type: text/plain; charset="iso-8859-1" Hi all. Is there any example of how to use gettimeofday() similar functions to manage time in Dev-C++? Thanks. |---------------------------------------| | Prof. Marcos Ennes Barreto | Coordenador - Computa??o | Centro Universit?rio La Salle | www.inf.unilasalle.edu.br/~barreto | barreto at unilasalle dot edu dot br |---------------------------------------| No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.3/824 - Release Date: 29/5/2007 13:01 ------------------------------ Message: 6 Date: Thu, 31 May 2007 00:16:35 +0200 (CEST) From: Per Westermark Subject: Re: [Dev-C++] Gettimeofday in dev-c++ To: barreto Cc: dev...@li... Message-ID: Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Check out the gnu documentation. It contains all information needed to use the GNU-based runtime library. You can also check out the documentation available on the MinGW site. Or you can just google gettimeofday() - it's a standard function, so you will get a lot of good hits. /pwm On Wed, 30 May 2007, barreto wrote: > > Hi all. > > Is there any example of how to use gettimeofday() similar functions to > manage time in Dev-C++? > > Thanks. > |---------------------------------------| > | Prof. Marcos Ennes Barreto > | Coordenador - Computa??o > | Centro Universit?rio La Salle > | www.inf.unilasalle.edu.br/~barreto > | barreto at unilasalle dot edu dot br > |---------------------------------------| > > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.5.472 / Virus Database: 269.8.3/824 - Release Date: 29/5/2007 > 13:01 > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > ------------------------------ Message: 7 Date: Thu, 31 May 2007 05:51:31 -0700 (PDT) From: MOHAMMED SEIDU Subject: Re: [Dev-C++] Dev-cpp-users Digest, Vol 12, Issue 11 To: dev...@li... Message-ID: <215...@we...> Content-Type: text/plain; charset="iso-8859-1" Hi Everyone, I need help regarding writing c++ application that either starts up when windows is started or runs at the background whiles windows runs using the Dev-C++ ide. dev...@li... wrote:Send Dev-cpp-users mailing list submissions to dev...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.ncet/lists/listinfo/dev-cpp-users or, via email, send a message with subject or body 'help' to dev...@li... You can reach the person managing the list at dev...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Dev-cpp-users digest..." Today's Topics: 1. Re: Dev-cpp-users Digest, Vol 12, Issue 9 (Luis Alfonso Giraldo) 2. Re: Dev-cpp-users Digest, Vol 12, Issue 9 (Per Westermark) 3. memory leak! (Lloyd) 4. Re: memory leak! (Jonathan Winterflood) 5. Re: memory leak! (Lloyd) 6. Re: memory leak! (Per Westermark) ---------------------------------------------------------------------- Message: 1 Date: Wed, 23 May 2007 23:21:37 -0500 From: "Luis Alfonso Giraldo" Subject: Re: [Dev-C++] Dev-cpp-users Digest, Vol 12, Issue 9 To: Message-ID: <200...@sm...> Content-Type: text/plain; charset="iso-8859-1" Hi, Please, I need code of sparse Matriz in C++: M?thods: 1. MakeDisperseMatrix(nF, nC): Matriz Dispersa vac?a 2. isEmpty(DisperseMatrix): Decide si la Matriz Dispersa est? vac?a 3. getNumberOfRows(DisperseMatrix): Indica el n?mero de filas de la Matriz Dispersa 4. getNumberOfColumns(DisperseMatrix): Indica el n?mero de columnas de la Matriz Dispersa 5. getNumberOfElements(DisperseMatrix): Indica el n?mero de elementos existentes en la Matriz Dispersa 6. printMatrix(DisperseMatrix): Imprime la matriz por filas 7. printMatrizInFile(DisperseMatrix, File): Imprime la matriz en un archivo (Guardar) 8. getRowOfInsertion(DisperseMatrix, nF, nC): Retorna una referencia a los predecesores en la fila a insertar. 9. makeNode(object, nF, nC): Crea un nodo. 10. getColumnOfInsertion(DisperseMatrix, nF, nC): Retorna una referencia a los predecesores en la columna a insertar. 11. InsertInMatriz(DisperseMatrix, nF, nC, object): Inserta "object" en la fila y columna indicada. 12. getValuePosition(DisperseMatrix, nF, nC): Retorna el valor almacenado en la fila y columna indicado. Si no existe devuelve 0. 13. getPorcentUsed(DisperseMatrix): Indica el porcentaje de elementos almacenados. 14. getMaxElements(DisperseMatrix): Indica el n?mero m?ximo de elementos que pueden ser almacenados en la matriz. 15. addDisperseMatrix(DisperseMatrix1, DisperseMatrix2): Devuelve en DisperseMatrix1 el resultado de sumar las dos matrices. 16. scaleDisperseMatrix(DisperseMatrix, valor): Retorna la matriz resultante de multiplicar cada posici?n existente por valor. 17. multDisperseMatrix (DisperseMatrix1,DisperseMatrix2, DisperseMatrix3): Retorna en DisperseMatrix3 el resultante de multiplicar las matrices DisperseMatrix1 y DisperseMatrix2(en ese orden). Thanks and excuse me :( Luis Alfonso Colombia ------------------------------ Message: 2 Date: Thu, 24 May 2007 07:34:19 +0200 (CEST) From: Per Westermark Subject: Re: [Dev-C++] Dev-cpp-users Digest, Vol 12, Issue 9 To: Luis Alfonso Giraldo Cc: dev...@li... Message-ID: Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Is this part of a school work? If your list is part of an existing library, Google should find the code. If it is part of a school assignment, you better start coding. /pwm On Wed, 23 May 2007, Luis Alfonso Giraldo wrote: > Hi, > > > Please, I need code of sparse Matriz in C++: > M?thods: > 1. MakeDisperseMatrix(nF, nC): Matriz Dispersa vac?a > 2. isEmpty(DisperseMatrix): Decide si la Matriz Dispersa est? vac?a > 3. getNumberOfRows(DisperseMatrix): Indica el n?mero de filas de la Matriz > Dispersa > 4. getNumberOfColumns(DisperseMatrix): Indica el n?mero de columnas de la > Matriz Dispersa > 5. getNumberOfElements(DisperseMatrix): Indica el n?mero de elementos > existentes en la Matriz Dispersa > 6. printMatrix(DisperseMatrix): Imprime la matriz por filas > 7. printMatrizInFile(DisperseMatrix, File): Imprime la matriz en un archivo > (Guardar) > 8. getRowOfInsertion(DisperseMatrix, nF, nC): Retorna una referencia a los > predecesores en la fila a insertar. > 9. makeNode(object, nF, nC): Crea un nodo. > 10. getColumnOfInsertion(DisperseMatrix, nF, nC): Retorna una referencia a > los predecesores en la columna a insertar. > 11. InsertInMatriz(DisperseMatrix, nF, nC, object): Inserta "object" en la > fila y columna indicada. > 12. getValuePosition(DisperseMatrix, nF, nC): Retorna el valor almacenado en > la fila y columna indicado. Si no existe devuelve 0. > 13. getPorcentUsed(DisperseMatrix): Indica el porcentaje de elementos > almacenados. > 14. getMaxElements(DisperseMatrix): Indica el n?mero m?ximo de elementos que > pueden ser almacenados en la matriz. > 15. addDisperseMatrix(DisperseMatrix1, DisperseMatrix2): Devuelve en > DisperseMatrix1 el resultado de sumar las dos matrices. > 16. scaleDisperseMatrix(DisperseMatrix, valor): Retorna la matriz resultante > de multiplicar cada posici?n existente por valor. > 17. multDisperseMatrix (DisperseMatrix1,DisperseMatrix2, DisperseMatrix3): > Retorna en DisperseMatrix3 el resultante de multiplicar las matrices > DisperseMatrix1 y DisperseMatrix2(en ese orden). > > Thanks and excuse me :( > > Luis Alfonso > Colombia > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > ------------------------------ Message: 3 Date: Thu, 24 May 2007 11:24:16 +0530 From: Lloyd Subject: [Dev-C++] memory leak! To: dev...@li... Message-ID: <1179986056.9291.6.camel@RCCF025> Content-Type: text/plain Hi, I have written a program in Linux. It opens a file and maps it to memory using mmap and unmaps and closes the file. I am using a custom written data structure as well in the program. There is no leak associated with the data structure. But some ware a big leak is present. (I dont know where) I assume it could be with mmap and munmap... Because as I open more and more files, the leak gradually increases to megabytes! but for each mam,p the munmap is called correspondingly. And the range which I give to unmap is correct. Where could be the source of problem? Even after the program exit the memory consumption remains same (not reducted to the program startup state). I see this with the aid of system monitoring tool.. please help me... Thanks and Regards, Lloyd ______________________________________ Scanned and protected by Email scanner ------------------------------ Message: 4 Date: Fri, 25 May 2007 08:28:29 +0200 From: "Jonathan Winterflood" Subject: Re: [Dev-C++] memory leak! To: ll...@cd... Cc: dev...@li... Message-ID: Content-Type: text/plain; charset="iso-8859-1" Hi, Maybe you should use valgrind to test your program for leaks (compiling with debugging symbols should help you get a digestable log) Jonathan On 5/24/07, Lloyd wrote: > > Hi, > I have written a program in Linux. > It opens a file and maps it to memory using mmap and unmaps and closes > the file. I am using a custom written data structure as well in the > program. There is no leak associated with the data structure. But some > ware a big leak is present. (I dont know where) I assume it could be > with mmap and munmap... Because as I open more and more files, the leak > gradually increases to megabytes! but for each mam,p the munmap is > called correspondingly. And the range which I give to unmap is correct. > > Where could be the source of problem? Even after the program exit the > memory consumption remains same (not reducted to the program startup > state). I see this with the aid of system monitoring tool.. > > please help me... > > Thanks and Regards, > Lloyd > > > > > ______________________________________ > Scanned and protected by Email scanner > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > -- linux, c'est une question de VI ou de MORE -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 5 Date: Fri, 25 May 2007 12:27:15 +0530 From: Lloyd Subject: Re: [Dev-C++] memory leak! To: dev...@li... Message-ID: <1180076235.12168.5.camel@RCCF025> Content-Type: text/plain Thank you Jonathan. I tried using valgrind, but my program uses wxWidgets (a GUI library). The out put of valgrind is unreadable and not understandable for me :( It shows lots of lines as output When I executed my program more and more, at the first stages (first few === message truncated === --------------------------------- Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. |
From: <Ber...@eu...> - 2007-06-05 09:28:28
|
... I searched the dev-cpp install directory, but I did not find = anything. Thanks for hints, Bernd --=20 Bernd M=FCnt Durchwahl: 030/69032-509 euroscript Deutschland GmbH Zentrale: 030/69032-300 Abteilung IT-Management Fax: 030/69032-505 Alt-Moabit 91 Mail: Ber...@eu... 10559 Berlin Web: http://www.euroscript.de |
From: Per W. <pw...@ia...> - 2007-06-05 05:53:44
|
Don't try to write functions that return arrays. Note that in C/C++, a pointer and an array is alsmost the same thing from a language perspective. The array name is always returned as a pointer to the first element in the array... Exactly what problem are you trying to solve? Let the function return a pointer to a string, and let the receiver accept this string. Why do you care about an array size? /pwm On Mon, 4 Jun 2007 fa...@un... wrote: > --===============0082291564== > Content-Type: text/plain; > Content-Transfer-Encoding: quoted-printable > > Hi, everyone,=20 > I have a problem with a string of char function. I have define a typedef = > char cad[80], and i want a function that return a char[80] type, because = > in dev-c++ is not posible return this type a write the function to return= > a pointer to char[80], in de form *cad. But, i don't get the function re= > turn the desired cad, the compiler always tell me a mismatch in the type = > to return, and the type i work. In linux-unix compiler CPP i don=B4t have= > problems, but in the windows dev-c++ version ever i had a error, or a mo= > s match. > > I agree your sugestions. > > -------------------------------------- > MENSAJE ENVIADO CON WMAIL 1.01 > UNIVERSIDAD DEL CAUCA > > > > > --===============0082291564== > Content-Type: text/plain; charset="us-ascii" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > --===============0082291564== > Content-Type: text/plain; charset="us-ascii" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > --===============0082291564==-- > |
From: <fa...@un...> - 2007-06-05 03:30:13
|
Hi, everyone, I have a problem with a string of char function. I have define a typedef char cad[80], and i want a function that return a char[80] type, because in dev-c++ is not posible return this type a write the function to return a pointer to char[80], in de form *cad. But, i don't get the function return the desired cad, the compiler always tell me a mismatch in the type to return, and the type i work. In linux-unix compiler CPP i don´t have problems, but in the windows dev-c++ version ever i had a error, or a mos match. I agree your sugestions. -------------------------------------- MENSAJE ENVIADO CON WMAIL 1.01 UNIVERSIDAD DEL CAUCA |
From: Per W. <pw...@ia...> - 2007-06-01 14:01:15
|
There are no temp pointer to free. The pointers are not allocated dynamically, so need not to be released. It's the contents that the pointer points to, that needs to be released. Your print is wrong. It should be *a to write the integer value that a points to. /pwm On Fri, 1 Jun 2007, Jan Mura wrote: > Hello, > > I would like to ask and clear the problem of freeing a memory previously > allocated. > I have got a program and this a simple example of something similar: > > #include<stdlib.h> > #include<stdio.h> > > void chng (int **in_a) > { > int *temp; > > temp = malloc(sizeof(int)); > *temp = 1; > *in_a = temp; > > } > > int main() > { > int *a; > > chng(&a); > > printf ("a = %d\n", a); > free (a); > > return 0; > } > > And I would like to know if this free (a); > at the end of main() frees also a temp pointer which is used in chng() > function. > It should to do this because it adress the same part of memory if I > understand it correctly. > > If you notice any other problem with the thing above, plese tell me. > > Thank you very much > > Jan Mura > jan...@vo... > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Jan M. <jan...@vo...> - 2007-06-01 13:07:43
|
Hello, I would like to ask and clear the problem of freeing a memory previously allocated. I have got a program and this a simple example of something similar: #include<stdlib.h> #include<stdio.h> void chng (int **in_a) { int *temp; temp = malloc(sizeof(int)); *temp = 1; *in_a = temp; } int main() { int *a; chng(&a); printf ("a = %d\n", a); free (a); return 0; } And I would like to know if this free (a); at the end of main() frees also a temp pointer which is used in chng() function. It should to do this because it adress the same part of memory if I understand it correctly. If you notice any other problem with the thing above, plese tell me. Thank you very much Jan Mura jan...@vo... |