Re: Static functions in C code

2006-06-01 Thread Steve Fairhead
Denis Doroshenko said: So how do you specify that a function should be visible only to the local compilation unit? Or, how do you keep others from using your locally-scoped (but not declared static) function in a global context? why would you even want that (moreover in opensource)? hide

Re: Static functions in C code

2006-06-01 Thread Darrin Chandler
On Fri, Jun 02, 2006 at 02:53:48AM +0100, Steve Fairhead wrote: Denis Doroshenko said: So how do you specify that a function should be visible only to the local compilation unit? Or, how do you keep others from using your locally-scoped (but not declared static) function in a global

Re: Static functions in C code

2006-05-31 Thread Denis Doroshenko
On 5/31/06, Brett Lymn [EMAIL PROTECTED] wrote: On Tue, May 30, 2006 at 04:55:14PM +0300, Denis Doroshenko wrote: why would you even want that (moreover in opensource)? hide for what reason? It's called lexical scoping - it has nothing really to do with security more to do with preventing

Re: Static functions in C code

2006-05-30 Thread matthew . garman
On Fri, May 26, 2006 at 08:29:58AM -0500, Marco Peereboom wrote: My answer is correct. It is not my fault that you don't have a clue about programming. Static has it's uses however for some reason the (open source) world at large seem not to understand what they are. Same is true with

Re: Static functions in C code

2006-05-30 Thread Denis Doroshenko
On 5/30/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Fri, May 26, 2006 at 08:29:58AM -0500, Marco Peereboom wrote: Static has it's uses however for some reason the (open source) world at large seem not to understand what they are. Same is true with typedef, it has its uses too but

Re: Static functions in C code

2006-05-30 Thread Brett Lymn
On Tue, May 30, 2006 at 04:55:14PM +0300, Denis Doroshenko wrote: why would you even want that (moreover in opensource)? hide for what reason? It's called lexical scoping - it has nothing really to do with security more to do with preventing namespace pollution. Clearly you have never

Re: Static functions in C code

2006-05-26 Thread Diego Giagio
On 5/25/06, Marco Peereboom [EMAIL PROTECTED] wrote: Because it'll clash. Clashing is good. I'm pretty sure you would be more successfull on a humor TV show as a clown than wasting people time and bandwith with stupid statements like that. And I don't mind if you are a OpenBSD developer,

Re: Static functions in C code

2006-05-26 Thread Diego Giagio
On 5/25/06, Ted Unangst [EMAIL PROTECTED] wrote: how many parse_config functions do you think spamd needs? It was an example. The point is: is there a reason for not using static on functions with internal linkage? There's at least one reason to use static: name clashes. -- DG

Re: Static functions in C code

2006-05-26 Thread mickey
On Fri, May 26, 2006 at 10:14:04AM -0300, Diego Giagio wrote: On 5/25/06, Marco Peereboom [EMAIL PROTECTED] wrote: Because it'll clash. Clashing is good. I'm pretty sure you would be more successfull on a humor TV show as a clown than wasting people time and bandwith with stupid statements

Re: Static functions in C code

2006-05-26 Thread Marco Peereboom
My answer is correct. It is not my fault that you don't have a clue about programming. Static has it's uses however for some reason the (open source) world at large seem not to understand what they are. Same is true with typedef, it has its uses too but mostly it is abused. I bet you have

Re: Static functions in C code

2006-05-26 Thread Jason Crawford
On 5/26/06, Diego Giagio [EMAIL PROTECTED] wrote: On 5/25/06, Ted Unangst [EMAIL PROTECTED] wrote: how many parse_config functions do you think spamd needs? It was an example. The point is: is there a reason for not using static on functions with internal linkage? There's at least one reason

Re: Static functions in C code

2006-05-26 Thread Jacob Yocom-Piatt
Original message Date: Fri, 26 May 2006 10:14:04 -0300 From: Diego Giagio [EMAIL PROTECTED] Subject: Re: Static functions in C code To: Marco Peereboom [EMAIL PROTECTED] Cc: misc@openbsd.org On 5/25/06, Marco Peereboom [EMAIL PROTECTED] wrote: Because it'll clash. Clashing is good

Re: Static functions in C code

2006-05-26 Thread Siju George
On 5/26/06, Diego Giagio [EMAIL PROTECTED] wrote: On 5/25/06, Marco Peereboom [EMAIL PROTECTED] wrote: Because it'll clash. Clashing is good. I'm pretty sure you would be more successfull on a humor TV show as a clown than wasting people time and bandwith with stupid statements like that. And

Re: Static functions in C code

2006-05-26 Thread Diego Giagio
On 5/25/06, Marco Peereboom [EMAIL PROTECTED] wrote: Because it'll clash. Clashing is good. I thought you were being sarcastic, and I was wrong. I strongly apologize. -- DG

Re: Static functions in C code

2006-05-26 Thread Diego Giagio
On 5/26/06, Jason Crawford [EMAIL PROTECTED] wrote: And Marco was explaining why he (and probably other OpenBSD devs) don't use static: name clashes. static makes things more difficult to debug, and having 50 different static functions named the same thing could get pretty confusing in large

Re: Static functions in C code

2006-05-26 Thread Diego Giagio
On 5/26/06, Jacob Yocom-Piatt [EMAIL PROTECTED] wrote: wow. this is just about the most offensive thing i've ever seen on list. that's not to say it should be censored ;). I wrongly interpreted Marco's statement, and shot him badly. all this from someone who spends time pointing finding

Re: Static functions in C code

2006-05-26 Thread Matthias Kilian
On Fri, May 26, 2006 at 11:59:51AM -0300, Diego Giagio wrote: Because it'll clash. Clashing is good. I thought you were being sarcastic, and I was wrong. I strongly apologize. No sarcasm. If you've clashes, the linker will tell you. But if you make everything static, you may using the same

Re: Static functions in C code

2006-05-26 Thread jjhartley
Original message from Diego Giagio [EMAIL PROTECTED]: 1. there are debugging requirements. Static functions do not expose entry points. Even for user-level code? If you are thinking there is a difference between kernel code userland code, no. Compilers compile code based upon the

Re: Static functions in C code

2006-05-26 Thread Diego Giagio
On 5/26/06, Matthias Kilian [EMAIL PROTECTED] wrote: No sarcasm. If you've clashes, the linker will tell you. But if you make everything static, you may using the same name for different things without noticing, and this *may* be confusing when reading the code. That's a very reasonable

Re: Static functions in C code

2006-05-25 Thread Marco Peereboom
Because it'll clash. Clashing is good. Diego Giagio wrote: Lately I've been reading OpenBSD code, both user-level and kernel-level, and I find it very clean and well organized. I have a concern, thought: why most applications don't use the 'static' keyword for functions with internal linkage

Re: Static functions in C code

2006-05-25 Thread Ted Unangst
On 5/25/06, Diego Giagio [EMAIL PROTECTED] wrote: Lately I've been reading OpenBSD code, both user-level and kernel-level, and I find it very clean and well organized. I have a concern, thought: why most applications don't use the 'static' keyword for functions with internal linkage ? Wouldn't

Re: Static functions in C code

2006-05-25 Thread jjhartley
Original message from Diego Giagio [EMAIL PROTECTED]: ... I have a concern, thought: why most applications don't use the 'static' keyword for functions with internal linkage ? Wouldn't that avoid function name clashes when developing large programs? Either because: 1. there are