Re: Yet another brute force sudoku solver
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Tue, 21 Oct 2008 02:09:26 +0000
Giorgos Keramidas said:
On Mon, 20 Oct 2008 04:51:34 -0700 (PDT), jameskuyper@xxxxxxxxxxx wrote:
Richard wrote:
jameskuyper@xxxxxxxxxxx writes:...
Richard wrote:
"Default User" <defaultuserbr@xxxxxxxxx> writes:
Trent Josephsen wrote:
Boon wrote:
#include <stdio.h>
static int grid[9][9];
...And file scope IS global (as anyone without a rod up their arse
knows
it) since anyone can declare an extern and then see it.
suggesting, such declarations have internal linkage, not external
linkage. As a result, declaring the same identifier with external
linkage in a different translation unit will not make this
definition visible in that translation unit. You need to understand
the distinction between scope and linkage.
I dont know where you got that impression of my meaning. I suppose its
that word "declare" again. I should have posted an example.
Perhaps you should. I don't know how to make a file scope identifier
with internal linkage (such as the array 'grid' defined above) visible
from another translation unit by "declar[ing] an extern", unless the
identifier with external linkage refers to something different from
what the identifier with internal linkage refers to. If you know how
to do this, could you give us an example?
You can define an object with internal linkage in one file, and a
function with external linkage that returns a pointer to that object.
Then other translation units can call the function to obtain the runtime
location of the object and use the pointer to access it.
Yes, and that would provide access to the object in question, but not using
the *identifier* in question. In the case in point, the identifier,
'grid', is at file scope (which means it can be seen throughout the rest
of the translation unit in which it appears) but is static (which means it
can't be seen from anywhere else). James's point is that just adding:
extern int grid[9][9];
to another translation unit will *not* make the original identifier visible
in that other translation unit.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.
- Follow-Ups:
- Re: Yet another brute force sudoku solver
- From: Giorgos Keramidas
- Re: Yet another brute force sudoku solver
- References:
- Yet another brute force sudoku solver
- From: Boon
- Re: Yet another brute force sudoku solver
- From: Trent Josephsen
- Re: Yet another brute force sudoku solver
- From: Default User
- Re: Yet another brute force sudoku solver
- From: Richard
- Re: Yet another brute force sudoku solver
- From: jameskuyper
- Re: Yet another brute force sudoku solver
- From: Richard
- Re: Yet another brute force sudoku solver
- From: jameskuyper
- Re: Yet another brute force sudoku solver
- From: Giorgos Keramidas
- Yet another brute force sudoku solver
- Prev by Date: Re: question about 2.6 in the faq
- Next by Date: Dell Canada Inc -- case ref# 623 – 9799 - 735
- Previous by thread: Re: Yet another brute force sudoku solver
- Next by thread: Re: Yet another brute force sudoku solver
- Index(es):
Relevant Pages
|