dev-cpp-users Mailing List for Dev-C++
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
(4) |
2
(13) |
3
(5) |
4
(14) |
5
(26) |
6
(16) |
7
(6) |
|
8
(3) |
9
(11) |
10
(16) |
11
(4) |
12
(11) |
13
(15) |
14
(5) |
|
15
(7) |
16
(16) |
17
(9) |
18
(27) |
19
(10) |
20
(8) |
21
(4) |
|
22
(3) |
23
(11) |
24
(10) |
25
(3) |
26
(12) |
27
(23) |
28
(12) |
|
29
(14) |
|
|
|
|
|
|
|
From: Per W. <pw...@ia...> - 2004-02-29 22:16:09
|
Since C and C++ does call by value, change_int will get a COPY of the
original pointer. This is fine if you want to change the value that the
pointer points to. However, with a COPY of the pointer, you can't allocate
a new pointer within change_int, and expect it to survive back to the
caller. In this case you are released the memory that the original
"number" pointer had allocated, but you don't change "number" to point to
the newly allocated block.
In C, you should use double indirection, i.e. pointer to pointer as can be
seen in my changes below.
Note that your change_int() has an incorrect name since it doesn't change
an int, but instead reallocates an int.
/Per W
On Sun, 29 Feb 2004, Vinicius wrote:
> Hello,
>
> The output of the code below is:
> number = 10
> number = 0 (or other number except 15)
>
> Why the output of the second 'number' is not 15? Why the 'number' address is
> not changed?
>
> Thanks in advance, Vinicius.
>
>
> #include <stdio.h>
> #include <stdlib.h>
>
> void change_int(int *num);
void change_int(int** num);
>
> int main(void)
> {
> int *number;
>
> number = (int *) malloc(sizeof(int));
> *number = 10;
> printf("number = %d\n", *number);
change_int(&number);
> change_int(number);
> printf("number = %d\n", *number);
>
> free(number);
> system("PAUSE");
> return 0;
> }
>
> void change_int(int *num)
void change_int(int** num)
> {
> int *temp;
int **temp;
>
> temp = num;
temp = *num;
> num = (int *) malloc(sizeof(int));
*num = (int*)malloc(sizeof(int));
> *num = 15;
**num = 15;
> free(temp);
> }
>
>
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> 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: Vinicius <cvi...@uo...> - 2004-02-29 22:07:31
|
Hello,
The output of the code below is:
number = 10
number = 0 (or other number except 15)
Why the output of the second 'number' is not 15? Why the 'number' address is
not changed?
Thanks in advance, Vinicius.
#include <stdio.h>
#include <stdlib.h>
void change_int(int *num);
int main(void)
{
int *number;
number = (int *) malloc(sizeof(int));
*number = 10;
printf("number = %d\n", *number);
change_int(number);
printf("number = %d\n", *number);
free(number);
system("PAUSE");
return 0;
}
void change_int(int *num)
{
int *temp;
temp = num;
num = (int *) malloc(sizeof(int));
*num = 15;
free(temp);
}
|
|
From: <or...@vp...> - 2004-02-29 15:47:33
|
Emiliano wrote: >>Sure, just compile the static version of the library, and recompile >th= e >>exe. The symbols will be linked in. >=20 > Please explain me what to do exactly. If I have understood, I need to p= ut > into my project the source files of the library too? I thought it was e= nough > to put into the linker parameters the ".a/.lib" file... No, you don't need to put the sources into the project. Actually, that=20 should never be done. You need to get the sources of the library, that you wish to use (in=20 this case jpeglib?). Then compile the static version of the library. How=20 to do that? Well, it depends heavily on the library that you're using.=20 Look around in the docs of the library to see how to compile the static=20 version of it. It will get you a libxxx.a file, where possibly xxx is=20 the name of the library. Then place it to a place, where GCC (Dev-C++)=20 can find it (maybe <DEVCPP>\lib), then add -lxxx to your project librarie= s. The symbols will be "hard-linked" into the exe from the lib. -- Greetings, Bal=E1zs |
|
From: Per W. <pw...@ia...> - 2004-02-29 15:28:33
|
I need blueprints to some of my machines but I don't know how to create them. Help! Hmm. Such a question doesn't contain enough information to be possible to answer. What definitions? Yours? Standard functions supplied with the compiler? 3rd-party libraries? Please never send a one-liner question unless you are really, really sure that one line is enough to make people know what you want, and how to help you! /Per W On Sun, 29 Feb 2004, Onet wrote: > i need headers to some definitions but i dont know how to create them help! |
|
From: Onet <ver...@po...> - 2004-02-29 15:22:33
|
i need headers to some definitions but i dont know how to create them = help! |
|
From: Mohammed I. <mi...@ac...> - 2004-02-29 14:26:42
|
From this site you can download many books in PDF format that requires Acrobat Reader 5.0 at least. ftp:194.85.35.67 anonymous login. Mohammed |
|
From: Hossein H. <ult...@em...> - 2004-02-29 12:18:47
|
Mike, As like as all of the recent messages I've posted to this list, sorry for this much late answer. I was too busy as this thread was going on, but I saved it till a time I can answer it, i.e. now! > You need to declare "it" as being of type iterator. So in the for > definition, you want: > > for (iterator it = myvec.begin(); it != myvec.end(); ++it) Although not wrong, but the principle of const-correctness tells us that "it" must be of type "cons_iterator" rather than just "iterator." > The iterator as assigned above is a pointer to the first element of the > vector. No, not necessarily! The types of vector<>::iterator, and vector<>::const_iterator are, as per the Standard, implementation-specific. That is, although they are most likely to be implemented using pure pointers, they are not needed to be so. In fact, they are some widely-used implementations of STL (such as STLPort) which do not implement the above stuff using pure pointers. Regards, --Hossein -- ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm |
|
From: Mats L. <mat...@to...> - 2004-02-29 11:58:35
|
You have program type settings under project options (Project / Project
Options / tab: General) You can select GUI, console, static lib or DLL
there. The other thing that pops up in my mind is that your DevCpp is
actually compiled for Windows so it has to be different from the Unix one.
The naming of those variables in the book wasn't very clever. I always name
my variables starting with something like "ml_" (my initials) or something
like that to avoid redeclarations. Do a global search and replace and change
LP to TCPL_LP :)
/M
From: "Kenneth P. Ruppel" <kpr...@op...>
> I have been working through Stroustrup's "The C++ Programming Language"
> Special Edition. I have run into a problemcompiling a program that
> Stroustrup says compiles and runs on his system, which I believe is a
> Unix system.
>
> The code (p.109) that doesn't compile is the following:
>
> #include <iostream>
> #include <string>
> #include <map>
> #include <cctype>
> using namespace std;
>
> // ENUM p.109
> enum Token_value{
> NAME, NUMBER, END,
> PLUS='+', MINUS='-=', MUL='*=', DIV='/',
> PRINT=';', ASSIGN='=', LP='(', RP=')'
>
> The error I get is the following:
>
> 'LP' redeclared as different kind of symbol
>
> This error comes from a statement in winnt.h, which is not included.
>
> The problem is, I have been to the C++ Learning newsgroup, and after
> letting them see that winnt.h is not included, etc., etc., they have
> left me with "there must be a switch in your application/IDE
> configuration that is trying to write a Windows program. You need to
> select configuration switches that produce a 'console' program in
> Windows or a DOS program."
>
> I am using Bloodshed 4.9.8.7, and I have never had to change the config
> to compile and run other programs that come up in a DOS window. And I
> have never changed the options in "Compiler Options". And also, the
> options that indicate trying to support C constructs, I selected "No",
> since I am trying to un-confuse myself and learn C++ only.
>
> Does anybody have any ideas why this error from winnt.h is appearing.
|
|
From: Emiliano <sky...@fa...> - 2004-02-29 08:19:54
|
Sorry but Outlook decided not to quote this morning... I'll try manually. >Sure, just compile the static version of the library, and recompile >the >exe. The symbols will be linked in. Please explain me what to do exactly. If I have understood, I need to put into my project the source files of the library too? I thought it was enough to put into the linker parameters the ".a/.lib" file... >> This is the way it works on other systems... >Well, on Linux, mostly dynamic libraries are used. (.so files) I know that, I LIKE shared stuff (libs, resources, memory and so on :)), and a lot. But for convenience reasons, now it would be MUCH better for me to have just a single executable and NO scattered files. I need to put into it just a couple of libs. Thanks for your attention, Emiliano |
|
From: Kenneth P. R. <kpr...@op...> - 2004-02-29 06:51:58
|
I have been working through Stroustrup's "The C++ Programming Language"
Special Edition. I have run into a problemcompiling a program that
Stroustrup says compiles and runs on his system, which I believe is a
Unix system.
The code (p.109) that doesn't compile is the following:
#include <iostream>
#include <string>
#include <map>
#include <cctype>
using namespace std;
// ENUM p.109
enum Token_value{
NAME, NUMBER, END,
PLUS='+', MINUS='-=', MUL='*=', DIV='/',
PRINT=';', ASSIGN='=', LP='(', RP=')'
The error I get is the following:
'LP' redeclared as different kind of symbol
This error comes from a statement in winnt.h, which is not included.
The problem is, I have been to the C++ Learning newsgroup, and after
letting them see that winnt.h is not included, etc., etc., they have
left me with "there must be a switch in your application/IDE
configuration that is trying to write a Windows program. You need to
select configuration switches that produce a 'console' program in
Windows or a DOS program."
I am using Bloodshed 4.9.8.7, and I have never had to change the config
to compile and run other programs that come up in a DOS window. And I
have never changed the options in "Compiler Options". And also, the
options that indicate trying to support C constructs, I selected "No",
since I am trying to un-confuse myself and learn C++ only.
Does anybody have any ideas why this error from winnt.h is appearing.
Ken
|
|
From: Per W. <pw...@ia...> - 2004-02-29 01:19:57
|
Yes, you can continue to cascade the pointers to pointers to... but with a
correctly written program you never need to since the goal of the program
is to either move the pointer or what the pointer points to.
/Per W
On Sat, 28 Feb 2004, David McKen wrote:
> Thanks,
>
> Just a question for future refrence but can the "pointer to" chain go
> infinitely?
> i.e.
> Does char *** x make a pointer-to-a-pointer-to-a-pointer-to-a-char ?
>
> Also refrences cannot be chained, right? That would be the logical
> AND
> operator anyway.
>
> ----- Original Message -----
> From: "Per Westermark" <pw...@ia...>
> To: "David McKen" <ci...@ya...>
> Cc: "Mailing List, Dev-Cpp" <dev...@li...>
> Sent: Saturday, February 28, 2004 3:20 PM
> Subject: Re: [Dev-C++] Crash with macro to template conversion
>
>
> > Oops. Too quick answer :-)
> > With the following construct, the caller will get back the newly
> allocated
> > pointer:
> >
> > void alloc(char*& ptr) {
> > ptr = new char[10];
> > }
> >
> > int main() {
> > char *ptr = NULL;
> > printf("ptr = %p\n",ptr);
> > alloc(ptr);
> > printf("ptr = %p\n",ptr);
> > return 0;
> > }
> >
> > /Per W
> >
> > On Sat, 28 Feb 2004, David McKen wrote:
> >
> > > you apparently did not read the end of my message,
> > >
> > > I know how to create a pointer to a pointer (**) I haven't heard
> > > about a
> > > refrence to a pointer (&* ?), what is the syntax for such a
> variable?
> > >
> > > ----- Original Message -----
> > > From: "Per Westermark" <pw...@ia...>
> > > To: "David McKen" <ci...@ya...>
> > > Cc: "Mailing List, Dev-Cpp" <dev...@li...>
> > > Sent: Saturday, February 28, 2004 5:27 AM
> > > Subject: Re: [Dev-C++] Crash with macro to template conversion
> > >
> > >
> > > > But you have not fixed the declaration of the ptr parameter
> yet.
> > > Any
> > > > allocations you make will behave ok inside the create()
> function,
> > > but the
> > > > caller will never get the value of the allocated pointer! You
> > > REALLY MUST
> > > > change del parameter declaration to either be a pointer to a
> > > pointer, or a
> > > > reference to a pointer!
> > > >
> > > > /Per W
> > > >
> > > > On Fri, 27 Feb 2004, David McKen wrote:
> > > >
> > > > > Sorry about that the correct definition is:
> > > > > template<class T>
> > > > > void create(T * ptr, int number, char * f_name = __FILE__,
> int
> > > l_num
> > > > > =
> > > > > __LINE__)
> > > > > {
> > > > > ptr = new T[number];
> > > > > if ( !ptr )
> > > > > {
> > > > > perror("malloc failure");
> > > > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name,
> l_num );
> > > > > abort();
> > > > > }
> > > > > }
> > > > >
> > > > > All the exception stuff was just trying to figure out if an
> error
> > > is
> > > > > even
> > > > > occuring.
> > > > >
> > > > > I am trying to keep to convention. The macro is not my code
> but
> > > code
> > > > > I am
> > > > > trying to replace. I am very tempted to change it but I also
> have
> > > > > RECREATE
> > > > > (wraps realloc()) and DESTROY (wraps free() ) which also need
> to
> > > be
> > > > > replaced. I could use macros to alter the function call but I
> am
> > > > > trying to
> > > > > remove all the macros I can (got some linked list macros to
> > > replace
> > > > > as well)
> > > > >
> > > > > So...How does one create a refrence to a pointer?
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "Per Westermark" <pw...@ia...>
> > > > > To: "David McKen" <ci...@ya...>
> > > > > Cc: "Mailing List, Dev-Cpp"
> <dev...@li...>
> > > > > Sent: Friday, February 27, 2004 7:08 AM
> > > > > Subject: Re: [Dev-C++] Crash with macro to template
> conversion
> > > > >
> > > > >
> > > > > > First of all - your create template function is declared to
> > > return
> > > > > void,
> > > > > > so why do you end it with return ptr?
> > > > > >
> > > > > > Second, you send in a T* ptr parameter. Note that since C++
> > > uses
> > > > > > call-by-value, this will behave like a lokal variable, i.e
> any
> > > > > assign to
> > > > > > ptr will not reflect back to the caller. You should change
> the
> > > > > first
> > > > > > parameter of create to be a reference to a pointer. That
> way,
> > > the
> > > > > assign
> > > > > > to ptr will reflect back to the variable obj of the caller.
> > > > > >
> > > > > > /Per W
> > > > > >
> > > > > > On Fri, 27 Feb 2004, David McKen wrote:
> > > > > >
> > > > > > > Ok here is my problem.
> > > > > > >
> > > > > > > I want to replace:
> > > > > > > #define CREATE(result, type, number) \
> > > > > > > do \
> > > > > > > { \
> > > > > > > if (!((result) = (type *) calloc ((number),
> > > sizeof(type)))) \
> > > > > > > { \
> > > > > > > perror("malloc failure"); \
> > > > > > > fprintf(stderr, "Malloc failure @ %s:%d\n", __FILE__,
> > > > > __LINE__ );
> > > > > > > \
> > > > > > > abort(); \
> > > > > > > } \
> > > > > > > } while(0)
> > > > > > >
> > > > > > > With it's C++ equivalent.
> > > > > > >
> > > > > > > So far I have:
> > > > > > > #define CREATE(result, type, num)
> > > create<type>((result),(num))
> > > > > > > template<class T>
> > > > > > > void create(T * ptr, int number, char * f_name =
> __FILE__,
> > > int
> > > > > l_num
> > > > > > > =
> > > > > > > __LINE__)
> > > > > > > {
> > > > > > > try {
> > > > > > > ptr = new T[number];
> > > > > > > }
> > > > > > > catch(bad_alloc& b)
> > > > > > > {
> > > > > > > perror("malloc failure");
> > > > > > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name,
> > > l_num );
> > > > > > > abort();
> > > > > > > }
> > > > > > > if ( !ptr )
> > > > > > > {
> > > > > > > perror("malloc failure");
> > > > > > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name,
> > > l_num );
> > > > > > > abort();
> > > > > > > }
> > > > > > > return ptr;
> > > > > > > }
> > > > > > >
> > > > > > > But the program crashes after the function call when any
> > > attempt
> > > > > to
> > > > > > > acces
> > > > > > > the data occours:
> > > > > > > e.g.
> > > > > > > OBJ_DATA * obj;
> > > > > > > CREATE( obj , OBJ_DATA, 1 );
> > > > > > >
> > > > > > > obj->some_field = 5; //Crashes here and obj = 0x0 from
> gdb.
> > > > > > >
> > > > > > > Thanks in Advance
> > > > > > > David McKen
> > > > > > >
> > > > > > >
> > > > > > > __________________________________
> > > > > > > Do you Yahoo!?
> > > > > > > Get better spam protection with Yahoo! Mail.
> > > > > > > http://antispam.yahoo.com/tools
> > > > > > >
> > > > > > >
> > > > > > > -------------------------------------------------------
> > > > > > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > > > > > Build and deploy apps & Web services for Linux with
> > > > > > > a free DVD software kit from IBM. Click Now!
> > > > > > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > > > > > _______________________________________________
> > > > > > > Dev-cpp-users mailing list
> > > > > > > Dev...@li...
> > > > > > > TO UNSUBSCRIBE:
> > > http://www23.brinkster.com/noicys/devcpp/ub.htm
> > > > > > >
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > -------------------------------------------------------
> > > > > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > > > > Build and deploy apps & Web services for Linux with
> > > > > > a free DVD software kit from IBM. Click Now!
> > > > > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > > > > _______________________________________________
> > > > > > 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
> > > > >
> > > > >
> > > > > __________________________________
> > > > > Do you Yahoo!?
> > > > > Get better spam protection with Yahoo! Mail.
> > > > > http://antispam.yahoo.com/tools
> > > > >
> > > > >
> > > > > -------------------------------------------------------
> > > > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > > > Build and deploy apps & Web services for Linux with
> > > > > a free DVD software kit from IBM. Click Now!
> > > > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > > > _______________________________________________
> > > > > Dev-cpp-users mailing list
> > > > > Dev...@li...
> > > > > TO UNSUBSCRIBE:
> http://www23.brinkster.com/noicys/devcpp/ub.htm
> > > > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> > > > >
> > > >
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > > Build and deploy apps & Web services for Linux with
> > > > a free DVD software kit from IBM. Click Now!
> > > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > > _______________________________________________
> > > > 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
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Get better spam protection with Yahoo! Mail.
> > > http://antispam.yahoo.com/tools
> > >
> > >
> > > -------------------------------------------------------
> > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > Build and deploy apps & Web services for Linux with
> > > a free DVD software kit from IBM. Click Now!
> > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > _______________________________________________
> > > Dev-cpp-users mailing list
> > > Dev...@li...
> > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> > >
> >
> >
> >
> > -------------------------------------------------------
> > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > Build and deploy apps & Web services for Linux with
> > a free DVD software kit from IBM. Click Now!
> > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > _______________________________________________
> > 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
>
>
> __________________________________
> Do you Yahoo!?
> Get better spam protection with Yahoo! Mail.
> http://antispam.yahoo.com/tools
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> 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: <or...@vp...> - 2004-02-29 01:00:54
|
Emiliano wrote: > Many thanks: I had to link with "-ljpeg", now it seems to work. >=20 > BUT, do I _always_ need to have external dlls coming with my app? Or is > there a way to include libraries into the executable? Sure, just compile the static version of the library, and recompile the=20 exe. The symbols will be linked in. > This is the way it works on other systems... Well, on Linux, mostly dynamic libraries are used. (.so files) -- Greetings, Bal=E1zs |
|
From: David M. <ci...@ya...> - 2004-02-29 00:57:24
|
Thanks,
Just a question for future refrence but can the "pointer to" chain go
infinitely?
i.e.
Does char *** x make a pointer-to-a-pointer-to-a-pointer-to-a-char ?
Also refrences cannot be chained, right? That would be the logical
AND
operator anyway.
----- Original Message -----
From: "Per Westermark" <pw...@ia...>
To: "David McKen" <ci...@ya...>
Cc: "Mailing List, Dev-Cpp" <dev...@li...>
Sent: Saturday, February 28, 2004 3:20 PM
Subject: Re: [Dev-C++] Crash with macro to template conversion
> Oops. Too quick answer :-)
> With the following construct, the caller will get back the newly
allocated
> pointer:
>
> void alloc(char*& ptr) {
> ptr = new char[10];
> }
>
> int main() {
> char *ptr = NULL;
> printf("ptr = %p\n",ptr);
> alloc(ptr);
> printf("ptr = %p\n",ptr);
> return 0;
> }
>
> /Per W
>
> On Sat, 28 Feb 2004, David McKen wrote:
>
> > you apparently did not read the end of my message,
> >
> > I know how to create a pointer to a pointer (**) I haven't heard
> > about a
> > refrence to a pointer (&* ?), what is the syntax for such a
variable?
> >
> > ----- Original Message -----
> > From: "Per Westermark" <pw...@ia...>
> > To: "David McKen" <ci...@ya...>
> > Cc: "Mailing List, Dev-Cpp" <dev...@li...>
> > Sent: Saturday, February 28, 2004 5:27 AM
> > Subject: Re: [Dev-C++] Crash with macro to template conversion
> >
> >
> > > But you have not fixed the declaration of the ptr parameter
yet.
> > Any
> > > allocations you make will behave ok inside the create()
function,
> > but the
> > > caller will never get the value of the allocated pointer! You
> > REALLY MUST
> > > change del parameter declaration to either be a pointer to a
> > pointer, or a
> > > reference to a pointer!
> > >
> > > /Per W
> > >
> > > On Fri, 27 Feb 2004, David McKen wrote:
> > >
> > > > Sorry about that the correct definition is:
> > > > template<class T>
> > > > void create(T * ptr, int number, char * f_name = __FILE__,
int
> > l_num
> > > > =
> > > > __LINE__)
> > > > {
> > > > ptr = new T[number];
> > > > if ( !ptr )
> > > > {
> > > > perror("malloc failure");
> > > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name,
l_num );
> > > > abort();
> > > > }
> > > > }
> > > >
> > > > All the exception stuff was just trying to figure out if an
error
> > is
> > > > even
> > > > occuring.
> > > >
> > > > I am trying to keep to convention. The macro is not my code
but
> > code
> > > > I am
> > > > trying to replace. I am very tempted to change it but I also
have
> > > > RECREATE
> > > > (wraps realloc()) and DESTROY (wraps free() ) which also need
to
> > be
> > > > replaced. I could use macros to alter the function call but I
am
> > > > trying to
> > > > remove all the macros I can (got some linked list macros to
> > replace
> > > > as well)
> > > >
> > > > So...How does one create a refrence to a pointer?
> > > >
> > > > ----- Original Message -----
> > > > From: "Per Westermark" <pw...@ia...>
> > > > To: "David McKen" <ci...@ya...>
> > > > Cc: "Mailing List, Dev-Cpp"
<dev...@li...>
> > > > Sent: Friday, February 27, 2004 7:08 AM
> > > > Subject: Re: [Dev-C++] Crash with macro to template
conversion
> > > >
> > > >
> > > > > First of all - your create template function is declared to
> > return
> > > > void,
> > > > > so why do you end it with return ptr?
> > > > >
> > > > > Second, you send in a T* ptr parameter. Note that since C++
> > uses
> > > > > call-by-value, this will behave like a lokal variable, i.e
any
> > > > assign to
> > > > > ptr will not reflect back to the caller. You should change
the
> > > > first
> > > > > parameter of create to be a reference to a pointer. That
way,
> > the
> > > > assign
> > > > > to ptr will reflect back to the variable obj of the caller.
> > > > >
> > > > > /Per W
> > > > >
> > > > > On Fri, 27 Feb 2004, David McKen wrote:
> > > > >
> > > > > > Ok here is my problem.
> > > > > >
> > > > > > I want to replace:
> > > > > > #define CREATE(result, type, number) \
> > > > > > do \
> > > > > > { \
> > > > > > if (!((result) = (type *) calloc ((number),
> > sizeof(type)))) \
> > > > > > { \
> > > > > > perror("malloc failure"); \
> > > > > > fprintf(stderr, "Malloc failure @ %s:%d\n", __FILE__,
> > > > __LINE__ );
> > > > > > \
> > > > > > abort(); \
> > > > > > } \
> > > > > > } while(0)
> > > > > >
> > > > > > With it's C++ equivalent.
> > > > > >
> > > > > > So far I have:
> > > > > > #define CREATE(result, type, num)
> > create<type>((result),(num))
> > > > > > template<class T>
> > > > > > void create(T * ptr, int number, char * f_name =
__FILE__,
> > int
> > > > l_num
> > > > > > =
> > > > > > __LINE__)
> > > > > > {
> > > > > > try {
> > > > > > ptr = new T[number];
> > > > > > }
> > > > > > catch(bad_alloc& b)
> > > > > > {
> > > > > > perror("malloc failure");
> > > > > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name,
> > l_num );
> > > > > > abort();
> > > > > > }
> > > > > > if ( !ptr )
> > > > > > {
> > > > > > perror("malloc failure");
> > > > > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name,
> > l_num );
> > > > > > abort();
> > > > > > }
> > > > > > return ptr;
> > > > > > }
> > > > > >
> > > > > > But the program crashes after the function call when any
> > attempt
> > > > to
> > > > > > acces
> > > > > > the data occours:
> > > > > > e.g.
> > > > > > OBJ_DATA * obj;
> > > > > > CREATE( obj , OBJ_DATA, 1 );
> > > > > >
> > > > > > obj->some_field = 5; //Crashes here and obj = 0x0 from
gdb.
> > > > > >
> > > > > > Thanks in Advance
> > > > > > David McKen
> > > > > >
> > > > > >
> > > > > > __________________________________
> > > > > > Do you Yahoo!?
> > > > > > Get better spam protection with Yahoo! Mail.
> > > > > > http://antispam.yahoo.com/tools
> > > > > >
> > > > > >
> > > > > > -------------------------------------------------------
> > > > > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > > > > Build and deploy apps & Web services for Linux with
> > > > > > a free DVD software kit from IBM. Click Now!
> > > > > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > > > > _______________________________________________
> > > > > > Dev-cpp-users mailing list
> > > > > > Dev...@li...
> > > > > > TO UNSUBSCRIBE:
> > http://www23.brinkster.com/noicys/devcpp/ub.htm
> > > > > >
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > -------------------------------------------------------
> > > > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > > > Build and deploy apps & Web services for Linux with
> > > > > a free DVD software kit from IBM. Click Now!
> > > > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > > > _______________________________________________
> > > > > 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
> > > >
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > Get better spam protection with Yahoo! Mail.
> > > > http://antispam.yahoo.com/tools
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > > Build and deploy apps & Web services for Linux with
> > > > a free DVD software kit from IBM. Click Now!
> > > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > > _______________________________________________
> > > > Dev-cpp-users mailing list
> > > > Dev...@li...
> > > > TO UNSUBSCRIBE:
http://www23.brinkster.com/noicys/devcpp/ub.htm
> > > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> > > >
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > Build and deploy apps & Web services for Linux with
> > > a free DVD software kit from IBM. Click Now!
> > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > _______________________________________________
> > > 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
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Get better spam protection with Yahoo! Mail.
> > http://antispam.yahoo.com/tools
> >
> >
> > -------------------------------------------------------
> > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > Build and deploy apps & Web services for Linux with
> > a free DVD software kit from IBM. Click Now!
> > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> 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
__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools
|
|
From: Emiliano <sky...@fa...> - 2004-02-29 00:12:26
|
Many thanks: I had to link with "-ljpeg", now it seems to work. BUT, do I _always_ need to have external dlls coming with my app? Or is there a way to include libraries into the executable? This is the way it works on other systems... Emiliano ----- Original Message ----- From: "Daniel K. O." <dan...@ya...> To: "Emiliano" <sky...@fa...> Cc: <dev...@li...> Sent: Sunday, February 29, 2004 12:44 AM Subject: Re: [Dev-C++] Another one with static libraries. > Emiliano wrote: > > >Does windows support static libraries? > > > >I include jpeg.lib (or any other .lib/.a file) into my project, but, when > >executing, windows complains about "jpeglib6b.dll" missing. > > > >This is not a big problem with other libraries coming with a .dll file, but > >jpeglib misses that one, and I don't want to compile it from scratch... at > >least would avoid that :) > > > > > > Some libs - like the libjpeg - have different dll versions for the same > thing. The lib you have is for another dll compilation. > I had a problem recently with libFLAC; the lib was exporting some MD5 > symbols, that were conflicting with the program. So I linked directly to > the libFLAC.dll - yes, MinGW can also link directly to the .dll, just > add it to the linker options. > > Or, if it doesn't work, go to gnuwin32 page and download the libjpeg > from them. > > > > Daniel K. O. > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > 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: Daniel K. O. <dan...@ya...> - 2004-02-28 23:55:40
|
Emiliano wrote: >Does windows support static libraries? > >I include jpeg.lib (or any other .lib/.a file) into my project, but, when >executing, windows complains about "jpeglib6b.dll" missing. > >This is not a big problem with other libraries coming with a .dll file, but >jpeglib misses that one, and I don't want to compile it from scratch... at >least would avoid that :) > > Some libs - like the libjpeg - have different dll versions for the same thing. The lib you have is for another dll compilation. I had a problem recently with libFLAC; the lib was exporting some MD5 symbols, that were conflicting with the program. So I linked directly to the libFLAC.dll - yes, MinGW can also link directly to the .dll, just add it to the linker options. Or, if it doesn't work, go to gnuwin32 page and download the libjpeg from them. Daniel K. O. |
|
From: Emiliano <sky...@fa...> - 2004-02-28 23:46:09
|
Does windows support static libraries? I include jpeg.lib (or any other .lib/.a file) into my project, but, when executing, windows complains about "jpeglib6b.dll" missing. This is not a big problem with other libraries coming with a .dll file, but jpeglib misses that one, and I don't want to compile it from scratch... at least would avoid that :) regards, Emiliano |
|
From: Per W. <pw...@ia...> - 2004-02-28 23:31:33
|
Oops. Too quick answer :-)
With the following construct, the caller will get back the newly allocated
pointer:
void alloc(char*& ptr) {
ptr = new char[10];
}
int main() {
char *ptr = NULL;
printf("ptr = %p\n",ptr);
alloc(ptr);
printf("ptr = %p\n",ptr);
return 0;
}
/Per W
On Sat, 28 Feb 2004, David McKen wrote:
> you apparently did not read the end of my message,
>
> I know how to create a pointer to a pointer (**) I haven't heard
> about a
> refrence to a pointer (&* ?), what is the syntax for such a variable?
>
> ----- Original Message -----
> From: "Per Westermark" <pw...@ia...>
> To: "David McKen" <ci...@ya...>
> Cc: "Mailing List, Dev-Cpp" <dev...@li...>
> Sent: Saturday, February 28, 2004 5:27 AM
> Subject: Re: [Dev-C++] Crash with macro to template conversion
>
>
> > But you have not fixed the declaration of the ptr parameter yet.
> Any
> > allocations you make will behave ok inside the create() function,
> but the
> > caller will never get the value of the allocated pointer! You
> REALLY MUST
> > change del parameter declaration to either be a pointer to a
> pointer, or a
> > reference to a pointer!
> >
> > /Per W
> >
> > On Fri, 27 Feb 2004, David McKen wrote:
> >
> > > Sorry about that the correct definition is:
> > > template<class T>
> > > void create(T * ptr, int number, char * f_name = __FILE__, int
> l_num
> > > =
> > > __LINE__)
> > > {
> > > ptr = new T[number];
> > > if ( !ptr )
> > > {
> > > perror("malloc failure");
> > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name, l_num );
> > > abort();
> > > }
> > > }
> > >
> > > All the exception stuff was just trying to figure out if an error
> is
> > > even
> > > occuring.
> > >
> > > I am trying to keep to convention. The macro is not my code but
> code
> > > I am
> > > trying to replace. I am very tempted to change it but I also have
> > > RECREATE
> > > (wraps realloc()) and DESTROY (wraps free() ) which also need to
> be
> > > replaced. I could use macros to alter the function call but I am
> > > trying to
> > > remove all the macros I can (got some linked list macros to
> replace
> > > as well)
> > >
> > > So...How does one create a refrence to a pointer?
> > >
> > > ----- Original Message -----
> > > From: "Per Westermark" <pw...@ia...>
> > > To: "David McKen" <ci...@ya...>
> > > Cc: "Mailing List, Dev-Cpp" <dev...@li...>
> > > Sent: Friday, February 27, 2004 7:08 AM
> > > Subject: Re: [Dev-C++] Crash with macro to template conversion
> > >
> > >
> > > > First of all - your create template function is declared to
> return
> > > void,
> > > > so why do you end it with return ptr?
> > > >
> > > > Second, you send in a T* ptr parameter. Note that since C++
> uses
> > > > call-by-value, this will behave like a lokal variable, i.e any
> > > assign to
> > > > ptr will not reflect back to the caller. You should change the
> > > first
> > > > parameter of create to be a reference to a pointer. That way,
> the
> > > assign
> > > > to ptr will reflect back to the variable obj of the caller.
> > > >
> > > > /Per W
> > > >
> > > > On Fri, 27 Feb 2004, David McKen wrote:
> > > >
> > > > > Ok here is my problem.
> > > > >
> > > > > I want to replace:
> > > > > #define CREATE(result, type, number) \
> > > > > do \
> > > > > { \
> > > > > if (!((result) = (type *) calloc ((number),
> sizeof(type)))) \
> > > > > { \
> > > > > perror("malloc failure"); \
> > > > > fprintf(stderr, "Malloc failure @ %s:%d\n", __FILE__,
> > > __LINE__ );
> > > > > \
> > > > > abort(); \
> > > > > } \
> > > > > } while(0)
> > > > >
> > > > > With it's C++ equivalent.
> > > > >
> > > > > So far I have:
> > > > > #define CREATE(result, type, num)
> create<type>((result),(num))
> > > > > template<class T>
> > > > > void create(T * ptr, int number, char * f_name = __FILE__,
> int
> > > l_num
> > > > > =
> > > > > __LINE__)
> > > > > {
> > > > > try {
> > > > > ptr = new T[number];
> > > > > }
> > > > > catch(bad_alloc& b)
> > > > > {
> > > > > perror("malloc failure");
> > > > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name,
> l_num );
> > > > > abort();
> > > > > }
> > > > > if ( !ptr )
> > > > > {
> > > > > perror("malloc failure");
> > > > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name,
> l_num );
> > > > > abort();
> > > > > }
> > > > > return ptr;
> > > > > }
> > > > >
> > > > > But the program crashes after the function call when any
> attempt
> > > to
> > > > > acces
> > > > > the data occours:
> > > > > e.g.
> > > > > OBJ_DATA * obj;
> > > > > CREATE( obj , OBJ_DATA, 1 );
> > > > >
> > > > > obj->some_field = 5; //Crashes here and obj = 0x0 from gdb.
> > > > >
> > > > > Thanks in Advance
> > > > > David McKen
> > > > >
> > > > >
> > > > > __________________________________
> > > > > Do you Yahoo!?
> > > > > Get better spam protection with Yahoo! Mail.
> > > > > http://antispam.yahoo.com/tools
> > > > >
> > > > >
> > > > > -------------------------------------------------------
> > > > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > > > Build and deploy apps & Web services for Linux with
> > > > > a free DVD software kit from IBM. Click Now!
> > > > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > > > _______________________________________________
> > > > > Dev-cpp-users mailing list
> > > > > Dev...@li...
> > > > > TO UNSUBSCRIBE:
> http://www23.brinkster.com/noicys/devcpp/ub.htm
> > > > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> > > > >
> > > >
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > > Build and deploy apps & Web services for Linux with
> > > > a free DVD software kit from IBM. Click Now!
> > > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > > _______________________________________________
> > > > 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
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Get better spam protection with Yahoo! Mail.
> > > http://antispam.yahoo.com/tools
> > >
> > >
> > > -------------------------------------------------------
> > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > Build and deploy apps & Web services for Linux with
> > > a free DVD software kit from IBM. Click Now!
> > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > _______________________________________________
> > > Dev-cpp-users mailing list
> > > Dev...@li...
> > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> > >
> >
> >
> >
> > -------------------------------------------------------
> > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > Build and deploy apps & Web services for Linux with
> > a free DVD software kit from IBM. Click Now!
> > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > _______________________________________________
> > 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
>
>
> __________________________________
> Do you Yahoo!?
> Get better spam protection with Yahoo! Mail.
> http://antispam.yahoo.com/tools
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> 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: David M. <ci...@ya...> - 2004-02-28 23:22:11
|
you apparently did not read the end of my message,
I know how to create a pointer to a pointer (**) I haven't heard
about a
refrence to a pointer (&* ?), what is the syntax for such a variable?
----- Original Message -----
From: "Per Westermark" <pw...@ia...>
To: "David McKen" <ci...@ya...>
Cc: "Mailing List, Dev-Cpp" <dev...@li...>
Sent: Saturday, February 28, 2004 5:27 AM
Subject: Re: [Dev-C++] Crash with macro to template conversion
> But you have not fixed the declaration of the ptr parameter yet.
Any
> allocations you make will behave ok inside the create() function,
but the
> caller will never get the value of the allocated pointer! You
REALLY MUST
> change del parameter declaration to either be a pointer to a
pointer, or a
> reference to a pointer!
>
> /Per W
>
> On Fri, 27 Feb 2004, David McKen wrote:
>
> > Sorry about that the correct definition is:
> > template<class T>
> > void create(T * ptr, int number, char * f_name = __FILE__, int
l_num
> > =
> > __LINE__)
> > {
> > ptr = new T[number];
> > if ( !ptr )
> > {
> > perror("malloc failure");
> > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name, l_num );
> > abort();
> > }
> > }
> >
> > All the exception stuff was just trying to figure out if an error
is
> > even
> > occuring.
> >
> > I am trying to keep to convention. The macro is not my code but
code
> > I am
> > trying to replace. I am very tempted to change it but I also have
> > RECREATE
> > (wraps realloc()) and DESTROY (wraps free() ) which also need to
be
> > replaced. I could use macros to alter the function call but I am
> > trying to
> > remove all the macros I can (got some linked list macros to
replace
> > as well)
> >
> > So...How does one create a refrence to a pointer?
> >
> > ----- Original Message -----
> > From: "Per Westermark" <pw...@ia...>
> > To: "David McKen" <ci...@ya...>
> > Cc: "Mailing List, Dev-Cpp" <dev...@li...>
> > Sent: Friday, February 27, 2004 7:08 AM
> > Subject: Re: [Dev-C++] Crash with macro to template conversion
> >
> >
> > > First of all - your create template function is declared to
return
> > void,
> > > so why do you end it with return ptr?
> > >
> > > Second, you send in a T* ptr parameter. Note that since C++
uses
> > > call-by-value, this will behave like a lokal variable, i.e any
> > assign to
> > > ptr will not reflect back to the caller. You should change the
> > first
> > > parameter of create to be a reference to a pointer. That way,
the
> > assign
> > > to ptr will reflect back to the variable obj of the caller.
> > >
> > > /Per W
> > >
> > > On Fri, 27 Feb 2004, David McKen wrote:
> > >
> > > > Ok here is my problem.
> > > >
> > > > I want to replace:
> > > > #define CREATE(result, type, number) \
> > > > do \
> > > > { \
> > > > if (!((result) = (type *) calloc ((number),
sizeof(type)))) \
> > > > { \
> > > > perror("malloc failure"); \
> > > > fprintf(stderr, "Malloc failure @ %s:%d\n", __FILE__,
> > __LINE__ );
> > > > \
> > > > abort(); \
> > > > } \
> > > > } while(0)
> > > >
> > > > With it's C++ equivalent.
> > > >
> > > > So far I have:
> > > > #define CREATE(result, type, num)
create<type>((result),(num))
> > > > template<class T>
> > > > void create(T * ptr, int number, char * f_name = __FILE__,
int
> > l_num
> > > > =
> > > > __LINE__)
> > > > {
> > > > try {
> > > > ptr = new T[number];
> > > > }
> > > > catch(bad_alloc& b)
> > > > {
> > > > perror("malloc failure");
> > > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name,
l_num );
> > > > abort();
> > > > }
> > > > if ( !ptr )
> > > > {
> > > > perror("malloc failure");
> > > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name,
l_num );
> > > > abort();
> > > > }
> > > > return ptr;
> > > > }
> > > >
> > > > But the program crashes after the function call when any
attempt
> > to
> > > > acces
> > > > the data occours:
> > > > e.g.
> > > > OBJ_DATA * obj;
> > > > CREATE( obj , OBJ_DATA, 1 );
> > > >
> > > > obj->some_field = 5; //Crashes here and obj = 0x0 from gdb.
> > > >
> > > > Thanks in Advance
> > > > David McKen
> > > >
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > Get better spam protection with Yahoo! Mail.
> > > > http://antispam.yahoo.com/tools
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > > Build and deploy apps & Web services for Linux with
> > > > a free DVD software kit from IBM. Click Now!
> > > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > > _______________________________________________
> > > > Dev-cpp-users mailing list
> > > > Dev...@li...
> > > > TO UNSUBSCRIBE:
http://www23.brinkster.com/noicys/devcpp/ub.htm
> > > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> > > >
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > Build and deploy apps & Web services for Linux with
> > > a free DVD software kit from IBM. Click Now!
> > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > _______________________________________________
> > > 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
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Get better spam protection with Yahoo! Mail.
> > http://antispam.yahoo.com/tools
> >
> >
> > -------------------------------------------------------
> > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > Build and deploy apps & Web services for Linux with
> > a free DVD software kit from IBM. Click Now!
> > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> 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
__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools
|
|
From: Emiliano <sky...@fa...> - 2004-02-28 22:09:38
|
----- Original Message -----
From: "Per Westermark" <pw...@ia...>
To: "Emiliano" <sky...@fa...>
Cc: <dev...@li...>
Sent: Saturday, February 28, 2004 10:11 PM
Subject: Re: [Dev-C++] Problem with jpeg.library
> The library is written in C, and your program in C++.
>
> do:
>
> extern "C" {
> #include "jpeglib.h"
> }
>
> to inform the compiler that it should look for the jpeg functions using
> the C calling convention, and not try to name-mangle the symbols.
Great!! I had tried to set "compile as C" the only file using jpeg lib and
it didn't work :)
with that directive, it worked at once!
thanks again,
Emiliano
|
|
From: Per W. <pw...@ia...> - 2004-02-28 21:22:28
|
The library is written in C, and your program in C++.
do:
extern "C" {
#include "jpeglib.h"
}
to inform the compiler that it should look for the jpeg functions using
the C calling convention, and not try to name-mangle the symbols.
/Per W
On Sat, 28 Feb 2004, Emiliano wrote:
> It won't see any function, ie I get errors like this one:
>
>
> [Linker error] undefined reference to `jpeg_std_error(jpeg_error_mgr*)'
>
>
>
> I have also included in the linker tab "jpeg.lib" and "libjpeg.a", both
> alone and together, but it won't change.
>
> Do I need to do something else?
>
> thanks,
> Emiliano
>
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> 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: Emiliano <sky...@fa...> - 2004-02-28 20:18:29
|
It won't see any function, ie I get errors like this one: [Linker error] undefined reference to `jpeg_std_error(jpeg_error_mgr*)' I have also included in the linker tab "jpeg.lib" and "libjpeg.a", both alone and together, but it won't change. Do I need to do something else? thanks, Emiliano |
|
From: Per W. <pw...@ia...> - 2004-02-28 13:38:26
|
But you have not fixed the declaration of the ptr parameter yet. Any
allocations you make will behave ok inside the create() function, but the
caller will never get the value of the allocated pointer! You REALLY MUST
change del parameter declaration to either be a pointer to a pointer, or a
reference to a pointer!
/Per W
On Fri, 27 Feb 2004, David McKen wrote:
> Sorry about that the correct definition is:
> template<class T>
> void create(T * ptr, int number, char * f_name = __FILE__, int l_num
> =
> __LINE__)
> {
> ptr = new T[number];
> if ( !ptr )
> {
> perror("malloc failure");
> fprintf( stderr, "Malloc failure @ %s:%d\n", f_name, l_num );
> abort();
> }
> }
>
> All the exception stuff was just trying to figure out if an error is
> even
> occuring.
>
> I am trying to keep to convention. The macro is not my code but code
> I am
> trying to replace. I am very tempted to change it but I also have
> RECREATE
> (wraps realloc()) and DESTROY (wraps free() ) which also need to be
> replaced. I could use macros to alter the function call but I am
> trying to
> remove all the macros I can (got some linked list macros to replace
> as well)
>
> So...How does one create a refrence to a pointer?
>
> ----- Original Message -----
> From: "Per Westermark" <pw...@ia...>
> To: "David McKen" <ci...@ya...>
> Cc: "Mailing List, Dev-Cpp" <dev...@li...>
> Sent: Friday, February 27, 2004 7:08 AM
> Subject: Re: [Dev-C++] Crash with macro to template conversion
>
>
> > First of all - your create template function is declared to return
> void,
> > so why do you end it with return ptr?
> >
> > Second, you send in a T* ptr parameter. Note that since C++ uses
> > call-by-value, this will behave like a lokal variable, i.e any
> assign to
> > ptr will not reflect back to the caller. You should change the
> first
> > parameter of create to be a reference to a pointer. That way, the
> assign
> > to ptr will reflect back to the variable obj of the caller.
> >
> > /Per W
> >
> > On Fri, 27 Feb 2004, David McKen wrote:
> >
> > > Ok here is my problem.
> > >
> > > I want to replace:
> > > #define CREATE(result, type, number) \
> > > do \
> > > { \
> > > if (!((result) = (type *) calloc ((number), sizeof(type)))) \
> > > { \
> > > perror("malloc failure"); \
> > > fprintf(stderr, "Malloc failure @ %s:%d\n", __FILE__,
> __LINE__ );
> > > \
> > > abort(); \
> > > } \
> > > } while(0)
> > >
> > > With it's C++ equivalent.
> > >
> > > So far I have:
> > > #define CREATE(result, type, num) create<type>((result),(num))
> > > template<class T>
> > > void create(T * ptr, int number, char * f_name = __FILE__, int
> l_num
> > > =
> > > __LINE__)
> > > {
> > > try {
> > > ptr = new T[number];
> > > }
> > > catch(bad_alloc& b)
> > > {
> > > perror("malloc failure");
> > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name, l_num );
> > > abort();
> > > }
> > > if ( !ptr )
> > > {
> > > perror("malloc failure");
> > > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name, l_num );
> > > abort();
> > > }
> > > return ptr;
> > > }
> > >
> > > But the program crashes after the function call when any attempt
> to
> > > acces
> > > the data occours:
> > > e.g.
> > > OBJ_DATA * obj;
> > > CREATE( obj , OBJ_DATA, 1 );
> > >
> > > obj->some_field = 5; //Crashes here and obj = 0x0 from gdb.
> > >
> > > Thanks in Advance
> > > David McKen
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Get better spam protection with Yahoo! Mail.
> > > http://antispam.yahoo.com/tools
> > >
> > >
> > > -------------------------------------------------------
> > > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > > Build and deploy apps & Web services for Linux with
> > > a free DVD software kit from IBM. Click Now!
> > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > _______________________________________________
> > > Dev-cpp-users mailing list
> > > Dev...@li...
> > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> > >
> >
> >
> >
> > -------------------------------------------------------
> > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > Build and deploy apps & Web services for Linux with
> > a free DVD software kit from IBM. Click Now!
> > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > _______________________________________________
> > 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
>
>
> __________________________________
> Do you Yahoo!?
> Get better spam protection with Yahoo! Mail.
> http://antispam.yahoo.com/tools
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> 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: <jab...@ta...> - 2004-02-28 12:46:01
|
What I am trying to do is to put a bitmap (a logo) in a "About Dialog Box". The problem is that the logo is shown, but the program freezes. I hope is clear now. Jorge > > From: oladipo olayiwola <ola...@ya...> > Date: 2004/02/27 Fri PM 10:19:11 EST > To: jab...@ta... > Subject: Re: [Dev-C++] displaying bitmap in a dialog box > > > To start with, I really don't know what you are trying to achieve, maybe you should be more specific so I can render any little advice I can . Hope to hear from you > > > --------------------------------- > Do you Yahoo!? > Get better spam protection with Yahoo! Mail > |
|
From: David M. <ci...@ya...> - 2004-02-28 06:06:24
|
Sorry about that the correct definition is:
template<class T>
void create(T * ptr, int number, char * f_name = __FILE__, int l_num
=
__LINE__)
{
ptr = new T[number];
if ( !ptr )
{
perror("malloc failure");
fprintf( stderr, "Malloc failure @ %s:%d\n", f_name, l_num );
abort();
}
}
All the exception stuff was just trying to figure out if an error is
even
occuring.
I am trying to keep to convention. The macro is not my code but code
I am
trying to replace. I am very tempted to change it but I also have
RECREATE
(wraps realloc()) and DESTROY (wraps free() ) which also need to be
replaced. I could use macros to alter the function call but I am
trying to
remove all the macros I can (got some linked list macros to replace
as well)
So...How does one create a refrence to a pointer?
----- Original Message -----
From: "Per Westermark" <pw...@ia...>
To: "David McKen" <ci...@ya...>
Cc: "Mailing List, Dev-Cpp" <dev...@li...>
Sent: Friday, February 27, 2004 7:08 AM
Subject: Re: [Dev-C++] Crash with macro to template conversion
> First of all - your create template function is declared to return
void,
> so why do you end it with return ptr?
>
> Second, you send in a T* ptr parameter. Note that since C++ uses
> call-by-value, this will behave like a lokal variable, i.e any
assign to
> ptr will not reflect back to the caller. You should change the
first
> parameter of create to be a reference to a pointer. That way, the
assign
> to ptr will reflect back to the variable obj of the caller.
>
> /Per W
>
> On Fri, 27 Feb 2004, David McKen wrote:
>
> > Ok here is my problem.
> >
> > I want to replace:
> > #define CREATE(result, type, number) \
> > do \
> > { \
> > if (!((result) = (type *) calloc ((number), sizeof(type)))) \
> > { \
> > perror("malloc failure"); \
> > fprintf(stderr, "Malloc failure @ %s:%d\n", __FILE__,
__LINE__ );
> > \
> > abort(); \
> > } \
> > } while(0)
> >
> > With it's C++ equivalent.
> >
> > So far I have:
> > #define CREATE(result, type, num) create<type>((result),(num))
> > template<class T>
> > void create(T * ptr, int number, char * f_name = __FILE__, int
l_num
> > =
> > __LINE__)
> > {
> > try {
> > ptr = new T[number];
> > }
> > catch(bad_alloc& b)
> > {
> > perror("malloc failure");
> > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name, l_num );
> > abort();
> > }
> > if ( !ptr )
> > {
> > perror("malloc failure");
> > fprintf( stderr, "Malloc failure @ %s:%d\n", f_name, l_num );
> > abort();
> > }
> > return ptr;
> > }
> >
> > But the program crashes after the function call when any attempt
to
> > acces
> > the data occours:
> > e.g.
> > OBJ_DATA * obj;
> > CREATE( obj , OBJ_DATA, 1 );
> >
> > obj->some_field = 5; //Crashes here and obj = 0x0 from gdb.
> >
> > Thanks in Advance
> > David McKen
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Get better spam protection with Yahoo! Mail.
> > http://antispam.yahoo.com/tools
> >
> >
> > -------------------------------------------------------
> > SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > Build and deploy apps & Web services for Linux with
> > a free DVD software kit from IBM. Click Now!
> > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> 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
__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools
|
|
From: <jab...@ta...> - 2004-02-28 03:03:58
|
I'm trying to put a bitmap in a dialog box. It's not working: a) it freezes, b) if I comment the loadimage line and move the box, it grays up the background without repainting. I'm using win 98. Here is the code:
.....
case WM_PAINT:
{
HBITMAP hbmSail;
BITMAP bm;
int X, Y;
hbmSail = (HBITMAP) LoadImage(GetModuleHandle (NULL), // hinst is global
MAKEINTRESOURCE(5),
IMAGE_BITMAP,
0,
0,
0);
if(!hbmSail){
MessageBox(hwnd, "Load of resources failed.", "Error",
MB_OK | MB_ICONEXCLAMATION);
return -1;
}
GetObject(hbmSail, sizeof(bm), &bm);
X = 20;
Y = 20;
HDC hdcMemory;
HDC hdc;
hdc=GetDC(hwnd);
hdcMemory = CreateCompatibleDC(hdc);
SelectObject(hdcMemory, hbmSail);
BitBlt(hdc, X, Y, bm.bmWidth, bm.bmHeight, hdcMemory, 0, 0, SRCCOPY);
DeleteDC(hdcMemory);
ReleaseDC (hwnd,hdc);
}
......
What am I doing wrong? or better, am I doing anything right?
Thanks for the help!!!
Jorge
|