lkml.org 
[lkml]   [1997]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: 2.1.22 unneeded global symbols
Date
In linux.dev.kernel, alan@lxorguk.ukuu.org.uk (Alan Cox) wrote:

>Its wrong. Your script needs to handle inline function export names and
>also assembler and references buried in include files. Also function
>names used as variables and passed directly or indirectly to functions.

If you want to pass a pointer to a variable to somewhere else, it doesn't
have to be extern; it can be made static.

In other words, code like

foo.h:

char *foo_msg(void);

foo.c:

#include "foo.h"

static char msg[]="This is an important message."

char *foo_msg()
{
return msg;
}

is perfectly all right, and doesn't pollute the global namespace with
the variable "msg".

You can pass addresses to static functions the same way.

\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.478 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site