Re: gcc and variable length arrays

2006-10-11 Thread Mark Bucciarelli
On Tue, Oct 10, 2006 at 02:42:12PM -0700, Joe wrote:
 
 By the way, if anyone has any pointers (no pun intended) for a
 CS newbie, any help and recommendations are always appeciated.
 I like the OpenBSD development community and hope to contribute
 some code and patches in the future.

Advanced UNIX Programming, by Stevens.

Very well written and organized.  The code samples are great too.

m



Re: gcc and variable length arrays

2006-10-10 Thread Ted Unangst

On 10/9/06, Joe [EMAIL PROTECTED] wrote:

I'm trying to find a compiler that supports variable length arrays.
I'm currently taking a computer science class and noticed that gcc's
support for variable lenght arrays is broken [0].


i think you'll be hard pressed to come up with an example that doesn't
actually work for you.



Re: gcc and variable length arrays

2006-10-10 Thread Joe

Ted Unangst wrote:

On 10/9/06, Joe [EMAIL PROTECTED] wrote:

I'm trying to find a compiler that supports variable length arrays.
I'm currently taking a computer science class and noticed that gcc's
support for variable lenght arrays is broken [0].


i think you'll be hard pressed to come up with an example that doesn't
actually work for you.

Thanks. I'm a student and just getting started and my instructor was 
telling the class how the schools version copies of MS Visual C 6.0 is 
not C99 compliant and that some of the examples in the book[0] fail to 
compile. I read up on GCC 3.3.5 and it appears that it is mostly 
compliant with a few issues, including the variable length arrays which 
happens to be on one of my homework assignments. But it looks like I'll 
be ok.



By the way, if anyone has any pointers (no pun intended) for a CS 
newbie, any help and recommendations are always appeciated. I like the 
OpenBSD development community and hope to contribute some code and 
patches in the future.



[0] A Structured Approach Using C ISBN: 0534491324



Re: gcc and variable length arrays

2006-10-10 Thread Sam Chill

On 10/10/06, Joe [EMAIL PROTECTED] wrote:

By the way, if anyone has any pointers (no pun intended) for a CS
newbie, any help and recommendations are always appeciated. I like the
OpenBSD development community and hope to contribute some code and
patches in the future.

Read the source tree. No really, check out a copy of the source tree
and read over daemons that sound interesting, deal with things you
wish to implement, or are currently studying. I don't code too much c,
but when I do I try to find similiar code in the OpenBSD tree and
study it first. If I want to make use a some function or library I
have never used before I first read the man page on it and then find
some examples of it in the tree. c is a fairly simple language, but it
takes huge amounts of practice to really become good at it (I hope to
be good someday...) and there is no better way (in my opinion) to
get better at it than by reading well written code. So sync up to
-current today and start reading, who knows you might even find a few
bugs.
Good luck,
Sam



Re: gcc and variable length arrays

2006-10-10 Thread Michael Small
Joe [EMAIL PROTECTED] writes:
...
 Thanks. I'm a student and just getting started and my instructor was
 telling the class how the schools version copies of MS Visual C 6.0 is
 not C99 compliant and that some of the examples in the book[0] fail to
 compile. I read up on GCC 3.3.5 and it appears that it is mostly
 compliant with a few issues, including the variable length arrays
 which happens to be on one of my homework assignments. But it looks
 like I'll be ok.

Aside from the compiler, you need to consider the C library if you
have to have full C99 compliance for some reason.  It doesn't appear
that it's all done yet in OpenBSD's libc.  Or at least the %a format
specifier for printf isn't there.  But I bet you won't end up needing
that.

 By the way, if anyone has any pointers (no pun intended) for a CS
 newbie, any help and recommendations are always appeciated. I like the
 OpenBSD development community and hope to contribute some code and
 patches in the future.
 

I took a course once and read some source from OpenBSD userland to try
to supplement what I was learning.  It seemed much nicer reading than
the GNU source for the same programs - clearer, more direct and to the
point.  If feasible I'd ignore the book your professor assigned and
read The C Programming Language by Kernighan and Ritchie and C, A
Reference Manual, by Harbison and Steel instead.  Some professors feel
an obligation to assign so called easier (and bulkier) texts.  It's a
waste of your time to read those sorts of books.  I can only imagine
that anything with the words a structured approach to... in the
title is not going to be any fun.

-- 
Mike Small
[EMAIL PROTECTED]



Re: gcc and variable length arrays

2006-10-09 Thread Andrew Pinski
On Mon, 2006-10-09 at 22:07 -0700, Joe wrote:
 I'm trying to find a compiler that supports variable length arrays.
 I'm currently taking a computer science class and noticed that gcc's 
 support for variable lenght arrays is broken [0].

The reason why it is broken is not the reason why you think.  But it
just accepts too much invalid code.

Well there are some other bugs but most you will not hit unless you use
goto's.

-- Pinski