Re: C programming question...[OT]

2000-05-08 Thread Neil Hollow
Can anyone recommend a good c programming newsgroup for general questions and queries. NH -- >From: Sam Bayne <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Re: C programming question...[OT] >Date: Fri, May 5, 2000, 3:42 am > >First of all, thank everyone

Re: C programming question...[OT]

2000-05-05 Thread Gordon Messmer
Sam Bayne wrote: > Hee hee, perl doesn't have pointers, but it DOES have references. Really? I thought those were new in Perl 5.6. > they have some idiot protections WRT segfault.) The thing that is really > confusing about C's pointers is not the "they're memory locations" > thing, > it's the

Re: C programming question...[OT]

2000-05-05 Thread Steve Borho
On Fri, May 05, 2000 at 01:24:30PM -0400, rpjday wrote: > On Fri, 5 May 2000, Ken Gosier wrote: > > > > > --- Steve Borho <[EMAIL PROTECTED]> wrote: > > > Speaking to just pure style, though, that while loop > > > reminds me of the > > > most efficient C snippet I've ever seen. It's the > > > s

Re: C programming question...[OT]

2000-05-05 Thread rpjday
On Fri, 5 May 2000, Ken Gosier wrote: > > --- Steve Borho <[EMAIL PROTECTED]> wrote: > > Speaking to just pure style, though, that while loop > > reminds me of the > > most efficient C snippet I've ever seen. It's the > > standard implementation > > of strcpy. > > > > for (;*s;) > >

RE: C programming question...[OT]

2000-05-05 Thread Mike McNally
> --- Steve Borho <[EMAIL PROTECTED]> wrote: > > Speaking to just pure style, though, that while loop > > reminds me of the > > most efficient C snippet I've ever seen. It's the > > standard implementation > > of strcpy. > > > > for (;*s;) > > *d++ = *s++; > > > One question about th

Re: C programming question...[OT]

2000-05-05 Thread Ken Gosier
--- Steve Borho <[EMAIL PROTECTED]> wrote: > Speaking to just pure style, though, that while loop > reminds me of the > most efficient C snippet I've ever seen. It's the > standard implementation > of strcpy. > > for (;*s;) > *d++ = *s++; One question about this code snippet: Won't

Re: C programming question...[OT]

2000-05-04 Thread Sam Bayne
First of all, thank everyone for helping me out with idiotic basic questions. Gordon Messmer wrote: > > 1) No, the programmers declared an array of 5 character pointers, not > an array of 5 characters. Perl 5 doesn't have pointers, so I understand > your confusion :) They're one of the things

Re: C programming question...[OT]

2000-05-04 Thread Tim Hockin
> #define MAXARG 4 > static char *dirs[MAXARG+1]; a 5 element array of pointers to characters (strings). > ac--; av++; > if (ac==0) dirs[0] = "/tftpboot"; /* default directory */ > while (ac-- > 0 && n < MAXARG) > dirs[n++] = *av++; > 1

Re: C programming question...[OT]

2000-05-04 Thread Steve Borho
On Thu, May 04, 2000 at 05:23:37PM -0700, Sam Bayne wrote: > while (ac-- > 0 && n < MAXARG) > dirs[n++] = *av++; > > 3. Stylistically, is that 'while' statement normal? It looks to > me like a syntax mistake waiting to happen, but I'll code > to th

Re: C programming question...[OT]

2000-05-04 Thread Gordon Messmer
1) No, the programmers declared an array of 5 character pointers, not an array of 5 characters. Perl 5 doesn't have pointers, so I understand your confusion :) They're one of the things that non-C programmers bitch about. (If you don't understand pointers, using them is a quick way to a segfau

Re: C programming question...[OT]

2000-05-04 Thread Steve Borho
On Thu, May 04, 2000 at 05:23:37PM -0700, Sam Bayne wrote: > So There I am, rooting around in the source to the tftpd server > (never you mind why) when I see this: > > - > #define MAXARG 4 > static char *dirs[MAXARG+1]; > > int > main(int ac, char *

C programming question...[OT]

2000-05-04 Thread Sam Bayne
So There I am, rooting around in the source to the tftpd server (never you mind why) when I see this: - #define MAXARG 4 static char *dirs[MAXARG+1]; int main(int ac, char **av) { register struct tftphdr *tp; register int n = 0;