Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

_ANSI_ARGS_ necessary?

157 views
Skip to first unread message

Eckhard Lehmann

unread,
Jul 3, 2006, 5:28:48 AM7/3/06
to
Hi,

I have seen that there is this _ANSI_ARGS_ macro everywhere in the Tcl
sources and also in many extension sources (in fact, it is generated by
the regular genStubs.tcl script).
I guess that it does conversions on function declarations like this:

Tcl_SomeFunction (interp, objc, objv)
Tcl_Interp *interp; /* comment */
int objc; /* ... */
CONST Tcl_Obj *objv[]; /* ... */
{
...
}

which take place in the Tcl- and extension sources. I can imagine that
this is necessary for very old compilers, whereas the standard tells
that function declarations can be like.

Tcl_SomeFunction (
Tcl_Interp *interp, /* comment */
int objc, /* ... */
CONST Tcl_Obj *objv[]) /* ... */
{
...
}

In my eye-driven taste, I don't have any problem with the first
declaration style. But always when I want to edit such sources or view
them more comfortably in a modern IDE, there are problems. The parsers
of those IDE's seem to be not able to parse the first declaration style
and the _ANSI_ARGS_ macro correctly, and so it's not possible to get an
useful code tree - the most important and helpful feature of IDE's.
This holds true for both IDE's I tried so far: Eclipse/CDT and MSVC
(Visual C++ 2005, Express Edition). When I remove the _ANSI_ARGS_ macro
and edit the function declarations to the second style, everything is
fine - I get a code tree and can jump around via mouse clicks. It also
does not affect the way the code is compiled by GCC and MSVC.

So my questions are:
(a) are the _ANSI_ARGS_ and old function declarations really necessary
any more?
(b) if the answer to (a) is "yes", is there a trick to get IDE's
parsing the files correctly? How do the members of the TCT and others
hack on Tcl, do they use VIM/make/ctags or MSVC & co.?
(c) What experience do others have?


TIA,

Eckhard

Donal K. Fellows

unread,
Jul 3, 2006, 8:40:35 AM7/3/06
to
Eckhard Lehmann wrote:
> So my questions are:
> (a) are the _ANSI_ARGS_ and old function declarations really necessary
> any more?

Probably not. Tcl's been using other ANSI features pretty heavily since
the alphas of 8.4 and nobody's complained yet. We (the Tcl Maintainers)
are phasing out the use of the _ANSI_ARGS_ macro from all internal APIs
now, but we're in less of a hurry to do it with our public declarations.
After all, they don't hurt much and there's no point in being very
unfriendly to people with ancient compilers. It's probably not their
fault that that they're stuck in the steam age. :-)

> (b) if the answer to (a) is "yes", is there a trick to get IDE's
> parsing the files correctly? How do the members of the TCT and others
> hack on Tcl, do they use VIM/make/ctags or MSVC & co.?

I use emacs (with occasional splashes of vi) as it happens. I've also
tried using Eclipse, but I've yet to push it to the point where I'm
effective when doing it that way; I'm happier coding C with the manual
open in another window so I can just go back and forth between the two
at high speed.

Donal.

Don Porter

unread,
Jul 3, 2006, 8:42:13 AM7/3/06
to
Eckhard Lehmann wrote:
> (a) are the _ANSI_ARGS_ and old function declarations really necessary
> any more?

No. That's why they've been removed from the Tcl 8.5 development
sources.

--
| Don Porter Mathematical and Computational Sciences Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|

Eckhard Lehmann

unread,
Jul 4, 2006, 2:23:23 AM7/4/06
to

Don Porter wrote:
> Eckhard Lehmann wrote:
> > (a) are the _ANSI_ARGS_ and old function declarations really necessary
> > any more?
>
> No. That's why they've been removed from the Tcl 8.5 development
> sources.

Ok, I've looked just at 8.4.x and extension sources, so I didn't
recognise. That also means that the declarations can vanish from
extension sources, and nothing evil will happen ;).

Eckhard

Eckhard Lehmann

unread,
Jul 4, 2006, 2:33:06 AM7/4/06
to

Donal K. Fellows wrote:

> I use emacs (with occasional splashes of vi) as it happens. I've also
> tried using Eclipse, but I've yet to push it to the point where I'm
> effective when doing it that way; I'm happier coding C with the manual
> open in another window so I can just go back and forth between the two
> at high speed.

I used to use Vim + ctags (tagexplorer.vim) as well, and it is still my
favourite editor. But I found to be much more productive with
Eclipse/CDT, once I got it working for me. It's a more comfortable
editor that wraps all the standard tools - make, gcc, gdb etc. - and
extends it with graphical editing, code browsing/completion and
debugging... very helpful. It's even possible to trigger Vi (via
plugin) and Emacs (builtin) edit mode.

Of course it does not do the job for you and the manual in another
browser window is still required ;-).


Eckhard

0 new messages