Re: c question

2004-09-22 Thread Eric Gaumer
On Wed, 2004-09-22 at 07:24, Paul Akkermans wrote: > Hi group, > > I have constructed the following code: > struct node > { TreeElementType elt; >struct node *left, *right; > }; > typedef struct node Node; > > typedef Node *Tree; > > #include > #include "tree.h" > > void WriteTreeSla

Re: c question

2004-09-22 Thread David Baron
On Wednesday 22 September 2004 17:24, [EMAIL PROTECTED] wrote: > int main (){ >  WriteTreeSlave("paul",0); >  } > --- > >-- It is my goal

Re: c question

2004-09-22 Thread Andrew Schulman
> I have constructed the following code: > Can anybody help me? You're on the wrong list. Try comp.lang.c. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

c question

2004-09-22 Thread Paul Akkermans
Hi group,   I have constructed the following code: - #include "TreeElement.h"   struct node { TreeElementType elt;   struct node *left, *right; };typedef struct node Node

Re: [OT] C++ question re. dyn. mem.

2003-08-14 Thread Sebastian Kapfer
On Wed, 06 Aug 2003 06:00:11 +0200, MJM wrote: > On Monday 04 August 2003 21:40, Sebastian Kapfer wrote: >> > // change the way it is accessed to prove a point int * p_b = (int >> >*)  p_a; >> >> Ouch. > > Try this in /usr/src/linux/kernel > > $ grep *\) *.c This is unfair. First, it's kernel-l

Re: [OT] C++ question re. dyn. mem.

2003-08-14 Thread Sebastian Kapfer
On Wed, 06 Aug 2003 19:00:11 +0200, MJM wrote: > I learned last night that there is a 3rd Ed. Evidently things have > changed and the complex language has gotten more complex - Right. > trying to be all things to all people. If this continues, C++ will be > too complex for normal programmers.

Re: [OT] C++ question re. dyn. mem.

2003-08-14 Thread Sebastian Kapfer
On Mon, 04 Aug 2003 05:00:12 +0200, MJM wrote: > Will the free store be properly maintained when the following is > executed? // a simple object is defined typedef struct { >uint32_t a; >uint64_t b; >uint8_tc; > } t_my_type; No typedef needed. This is C++. struct t_my_type {

Re: [OT] C++ question re. dyn. mem.

2003-08-14 Thread Isaac To
> "Al" == Al Davis <[EMAIL PROTECTED]> writes: Al> Since you didn't say what uint64_t is, let me make a diabolical Al> definition of it. uint64_t is a type defined in C99, which is always a 64-bit unsigned integer. Whether it is already in your C++ compiler depends pretty much on pla

Re: [OT] C++ question re. dyn. mem.

2003-08-14 Thread Bijan Soleymani
--jq0ap7NbKX2Kqbes Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 06, 2003 at 10:36:42AM -0400, MJM wrote: > On Wednesday 06 August 2003 01:02, Dave Carrigan wrote: > > >?Language experts sure get their shorts knotted

Re: [OT] C++ question re. dyn. mem.

2003-08-14 Thread Pigeon
On Tue, Aug 05, 2003 at 03:40:42AM +0200, Sebastian Kapfer wrote: > On Mon, 04 Aug 2003 05:00:12 +0200, MJM wrote: > > // change the way it is accessed to prove a point int * p_b = (int *) > > p_a; > > // p_a and p_b point to the same block of dyn. allocated memory; > > Do they? Watch out for inhe

Re: [OT] C++ question re. dyn. mem.

2003-08-14 Thread MJM
On Tuesday 05 August 2003 14:02, Pigeon wrote: > On Tue, Aug 05, 2003 at 03:40:42AM +0200, Sebastian Kapfer wrote: > > On Mon, 04 Aug 2003 05:00:12 +0200, MJM wrote: > > > // change the way it is accessed to prove a point int * p_b = (int *) > > > p_a; > > > // p_a and p_b point to the same block o

Re: [OT] C++ question re. dyn. mem.

2003-08-14 Thread MJM
On Wednesday 06 August 2003 09:30, Sebastian Kapfer wrote: > > They do. My app would be broken from the start if I could not rely on > > this capability.  This style of type conversion is covered in elementary > > C++ books by Bjarne.  It's not unusual. > > Exactly where? I don't remember such cast

Re: [OT] C++ question re. dyn. mem.

2003-08-14 Thread Dave Carrigan
On Wed, Aug 06, 2003 at 10:36:42AM -0400, MJM wrote: > On Wednesday 06 August 2003 01:02, Dave Carrigan wrote: > > > Language experts sure get their shorts knotted up over simple questions. > > >   > > > > Because your question had to do with undefined and > > implementation-dependent behavior. >

Re: [OT] C++ question re. dyn. mem.

2003-08-11 Thread Sebastian Kapfer
On Tue, 05 Aug 2003 22:00:13 +0200, Pigeon wrote: >> No. You have to delete the original pointer (with the original type). >> Everything else is undefined behaviour, i.e. it could work, it could >> leak memory (completely or partly), it could crash, or even print "42". >> It might even work someti

Re: [OT] C++ question re. dyn. mem.

2003-08-10 Thread Vineet Kumar
* Pigeon ([EMAIL PROTECTED]) [030805 12:52]: > On Tue, Aug 05, 2003 at 03:40:42AM +0200, Sebastian Kapfer wrote: > > On Mon, 04 Aug 2003 05:00:12 +0200, MJM wrote: > > > I think the free store will be maintained properly because there is a > > > control block attached to the allocated block of stor

Re: [OT] C++ question re. dyn. mem.

2003-08-07 Thread MJM
On Monday 04 August 2003 21:40, Sebastian Kapfer wrote: > > // change the way it is accessed to prove a point int * p_b = (int *) > > p_a; > > Ouch. Try this in /usr/src/linux/kernel $ grep *\) *.c > > > // p_a and p_b point to the same block of dyn. allocated memory; > > Do they? They do. My

Re: [OT] C++ question re. dyn. mem.

2003-08-07 Thread MJM
On Wednesday 06 August 2003 15:20, Sebastian Kapfer wrote: > You obviously don't understand the point of the new cast operators. They > don't take power away from you, in fact they give you more power than > before I didn't _know_ about the new cast operators and yet things are working very well

Re: [OT] C++ question re. dyn. mem.

2003-08-06 Thread Al Davis
I think all of the responses are missing something very important. Let me try On Sunday 03 August 2003 08:57 pm, MJM wrote: > Will the free store be properly maintained when the following > is executed? // a simple object is defined > typedef struct > { >uint32_t a; >uint64_t b;

Re: [OT] C++ question re. dyn. mem.

2003-08-06 Thread Pigeon
On Wed, Aug 06, 2003 at 03:30:57PM +0200, Sebastian Kapfer wrote: > On Wed, 06 Aug 2003 06:00:11 +0200, MJM wrote: > > That was way over the top. That stuff is for compiler writers, not > > application programmers. I did not start a knowledge contest. If I did > > inadvertently, then you win. > >

Re: [OT] C++ question re. dyn. mem.

2003-08-06 Thread Isaac To
> "MJM" == MJM <[EMAIL PROTECTED]> writes: MJM> They do. My app would be broken from the start if I could not rely MJM> on this capability. This style of type conversion is covered in MJM> elementary C++ books by Bjarne. It's not unusual. You must be MJM> aware of what you

Re: [OT] C++ question re. dyn. mem.

2003-08-06 Thread MJM
On Wednesday 06 August 2003 01:02, Dave Carrigan wrote: > > Language experts sure get their shorts knotted up over simple questions. > >   > > Because your question had to do with undefined and > implementation-dependent behavior. I know that. See my other posts. I asked a question about handli

Re: [OT] C++ question re. dyn. mem.

2003-08-06 Thread Dave Carrigan
On Tue, Aug 05, 2003 at 11:21:04PM -0400, MJM wrote: > On Monday 04 August 2003 21:40, Sebastian Kapfer wrote: > > > // change the way it is accessed to prove a point int * p_b = (int *) > > > p_a; > > > > Ouch. > > Try this in /usr/src/linux/kernel > > $ grep *\) *.c Well, C is not C++, so grep

Re: [OT] C++ question re. dyn. mem.

2003-08-04 Thread Pigeon
On Sun, Aug 03, 2003 at 10:57:21PM -0400, MJM wrote: > Will the free store be properly maintained when the following is executed? Yes. -- Pigeon Be kind to pigeons Get my GPG key here: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x21C61F7F pgp0.pgp Description: PGP signature

[OT] C++ question re. dyn. mem.

2003-08-03 Thread MJM
Will the free store be properly maintained when the following is executed? // a simple object is defined typedef struct { uint32_t a; uint64_t b; uint8_t c; } t_my_type; // allocate some memory for an instance of this object t_my_type * p_a = (t_my_type) new t_my_type; // chan

Re: boolalpha (c++ question)

2003-03-05 Thread Alaa The Great
On Wed, 5 Mar 2003 09:29:15 -0500 Kevin Coyner <[EMAIL PROTECTED]> wrote: > Second, question about how to best set up the dual compilers: Like > you, I'll use 2.95 to compile downloaded software, and 3.2 for stuff > I write. Do you change the symlink in /usr/bin depending upon what > you are doi

Re: boolalpha (c++ question)

2003-03-05 Thread Kevin Coyner
On Wed, Mar 05, 2003 at 03:21:39PM +0200, Alaa The Great wrote.. > AFAIK GCC 2.95 doesn't have the ios_base namespace , you'll have to > use ios instead. > > however boolalpha is not implemented in 2.95, so you'll have install > g++-3.2 (only in testing I believe). > > if you plan on lear

Re: boolalpha (c++ question)

2003-03-05 Thread Alaa The Great
On Wed, 5 Mar 2003 07:33:19 -0500 Kevin Coyner <[EMAIL PROTECTED]> wrote: > > I'm learning C++ and ran into a bit of difficulty with boolalpha. > > I guess I don't have all the right libraries loaded (although I > would have thought this one was quite basic) because the following > doesn't work:

boolalpha (c++ question)

2003-03-05 Thread Kevin Coyner
I'm learning C++ and ran into a bit of difficulty with boolalpha. I guess I don't have all the right libraries loaded (although I would have thought this one was quite basic) because the following doesn't work: cout.setf(ios_base::boolalpha); // from textbook The err msg I get is: `ios_base'

Re: C++ question

2000-02-16 Thread Colin Marquardt
* Shao Zhang <[EMAIL PROTECTED]> writes: > The code was originally written by someone else, and I had to modify it. > It uses a whole bunch of libraries written in C. And I am too lazy to > port it to C++. So I had to use both gcc and g++. But it is just a pain > to keep the memory allocation cons

Re: C++ question

2000-02-16 Thread Shao Zhang
Noah L. Meyerhans [EMAIL PROTECTED] wrote: > -BEGIN PGP SIGNED MESSAGE- > > On Tue, 15 Feb 2000, Shao Zhang wrote: > > > Eg. if I compile with this: > > $ g++ -g -c misc.c > > misc.c: In function `char * cash(double, int, int)': > > misc.c:44: implicit declaration of function `int bracket

Re: C++ question

2000-02-16 Thread Noah L. Meyerhans
-BEGIN PGP SIGNED MESSAGE- On Tue, 15 Feb 2000, Shao Zhang wrote: > Eg. if I compile with this: > $ g++ -g -c misc.c > misc.c: In function `char * cash(double, int, int)': > misc.c:44: implicit declaration of function `int bracket(...)' > misc.c:45: implicit declaration of function `int c

Re: C++ question

2000-02-15 Thread Shao Zhang
Bryan Scaringe [EMAIL PROTECTED] wrote: > It is my understandng that in order for C++ to "delete" a > dynamically-allocated > object, that object need to have been created via "new". > > That said, I'd like to see the code where you do the allocation. You are right. the memory allocation is done

RE: C++ question

2000-02-15 Thread Bryan Scaringe
It is my understandng that in order for C++ to "delete" a dynamically-allocated object, that object need to have been created via "new". That said, I'd like to see the code where you do the allocation. Also, you may need to type-cast the void pointer. The new compiler version may be more picky a

C++ question

2000-02-15 Thread Shao Zhang
Hi, I have posted this to comp.lang.c++, but hope someone here can help me as well. Thanks. = I have a c++ program that compiles fine with earlier version of g++, but it no longer compiles with the newsest release 2.95.2. Here i

Re: C question

1999-03-25 Thread John Galt
The man page for TCSH shows how to check permissions within a TCSH script. try searching for filetest. On Tue, 16 Mar 1999, richard wrote: > > > I know this is the wrong place to ask, so I've got two questions now. What is > a good unix/C > newsgroup? I think I'm gonna need some help. Now my

Re: C question

1999-03-25 Thread David Wright
Quoting richard ([EMAIL PROTECTED]): > I've got a perl script that checks the permissions and creates directories. > Now I want to rewrite > the script in C. I know nothing about checking permissions nor creating > directories with C. I > don't even know if it's possible, so if someone does know

Re: C question

1999-03-25 Thread E.L. Meijer \(Eric\)
> I've got a perl script that checks the permissions and creates > directories. Now I want to rewrite the script in C. I know nothing > about checking permissions nor creating directories with C. I don't > even know if it's possible, so if someone does know how to do this or a > place that might

Re: C question

1999-03-24 Thread Ole J. Tetlie
>[EMAIL PROTECTED] (richard) > > I know this is the wrong place to ask, so I've got two questions > now. What is a good unix/C newsgroup? I think I'm gonna need some For general C, try comp.lang.c. It's probably the wrong place for these questions, since they are UNIX specific. comp.unix.programm

Re: C question

1999-03-24 Thread Richard Harran
Try the comp.lang.c newsgroup for C questions. For creating directories, try #include int mkdir(const char *path, mode_t mode); For removing directories, #include int rmdir(const char *path); Also see man 3 ... opendir closedir telldir

C question

1999-03-24 Thread richard
I know this is the wrong place to ask, so I've got two questions now. What is a good unix/C newsgroup? I think I'm gonna need some help. Now my real question. I've got a perl script that checks the permissions and creates directories. Now I want to rewrite the script in C. I know nothing abou

Re: g++272 libs, revisited. (This is really a C question)

1998-11-14 Thread Chip Grandits
ogram was bigger and you wanted to be frugal with memory: when your done using 'thisTime'*/ delete thisTime; /*Don't use thisTime anymore unless you reallocate, or you're making a dangling pointer mistake*/ This is really a C question though, there is lots of good literature on being

Re: Newbie C Question

1998-07-25 Thread E.L. Meijer \(Eric\)
> This is a multi-part message in MIME format. Why? Peter wrote: > stdio is in /usr/include however; the compiler, by default > should be looking there via #define. Therefore Um, make that #include , OK ? :^| Eric -- E.L. Meijer ([EMAIL P

Re: Newbie C Question

1998-07-25 Thread Peter Iannarelli
Date: July 25, 1998 8:56 AM Subject: Newbie C Question > I've never written C for any UNIX but want very >much to learn. Getting started might be the most >difficult part. The following question appears to me >to be a somewhat Debian-Linux-specific (although I could >b

Re: Newbie C Question

1998-07-25 Thread Oliver Elphick
Art Lemasters wrote: > I've never written C for any UNIX but want very >much to learn. Getting started might be the most >difficult part. The following question appears to me >to be a somewhat Debian-Linux-specific (although I could >be wrong). > > How do I compile and link

Newbie C Question

1998-07-25 Thread Art Lemasters
I've never written C for any UNIX but want very much to learn. Getting started might be the most difficult part. The following question appears to me to be a somewhat Debian-Linux-specific (although I could be wrong). How do I compile and link hello.c? ...can't seem to find stdio.h fo