Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #139332

Re: [Solved] Need some help getting to my feet

Subject Re: [Solved] Need some help getting to my feet
Newsgroups comp.lang.c
References (8 earlier) <0c9de971-6b25-4b3d-b8d0-c2ab1df9efd1@googlegroups.com> <20181226190200.579c2b3b60053c907d8c80d3@g{oogle}mail.com> <gzwWD.177487$le.59699@fx14.iad> <RZwWD.201178$%55.76713@fx10.am4> <slrn3s3kq2nf0p.iod.ike@iceland.freeshell.org>
From Bart <bc@freeuk.com>
Message-ID <l1QWD.82440$Of2.66083@fx03.am4> (permalink)
Organization virginmedia.com
Date 2019-01-01 20:25 +0000

Show all headers | View raw


On 01/01/2019 19:14, Ike Naar wrote:
> On 2018-12-31, Bart <bc@freeuk.com> wrote:
>> There are quite a few issues with having declarations scattered
>> anywhere, such as having to locate the declaration for name (which will
>> involve scanning every line backwards to the top of a function).
> 
> Often those declarations are not "scatterd anywhere", they are
> just a few lines above the point where the name is used so
> there is no need to scroll back to the top of the function.

'Where the name is used' may span dozens of lines. So you need to search 
backwards from where you first see it. And a name might have 
function-wide scope so is declared at the top, but you don't know that 
(even if you glance at the top and see it there because they could be a 
more local declaration), so you still have to check every line, working 
backwards.

It can also happen there are two variables with similar names (call them 
a3947 and a3497 here); you see a3947 being used, glance at the top, and 
see a3497 being declared with no other likely variables in sight. It is 
easy to assume that that is the variable declaration you want.

(Have a look at the 219Kloc source of the amalgamated sqlite3 project, 
which mixes names declared at the top, with names declared within the 
code (not so much, just enough that you HAVE to carefully double-check) 
as well as some very confusing names plus, sometimes, the same name 
reused within different scopes in a function.)

Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: [Solved] Need some help getting to my feet Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-05-04 13:31 +0000
  Re: [Solved] Need some help getting to my feet luser droog <luser.droog@gmail.com> - 2018-05-04 17:19 -0700
  Re: [Solved] Need some help getting to my feet Tim Rentsch <txr@alumni.caltech.edu> - 2018-05-18 21:55 -0700
    Re: [Solved] Need some help getting to my feet already5chosen@yahoo.com - 2018-05-21 03:26 -0700
      Re: [Solved] Need some help getting to my feet Tim Rentsch <txr@alumni.caltech.edu> - 2018-06-14 03:00 -0700
        Mixing declarations and statements in C code (Was: [Solved] Need some help getting to my feet) gazelle@shell.xmission.com (Kenny McCormack) - 2018-12-26 06:43 +0000
      Re: [Solved] Need some help getting to my feet Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-12-26 19:02 +0300
        Re: [Solved] Need some help getting to my feet Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-12-31 18:01 +0000
        Re: [Solved] Need some help getting to my feet Richard Damon <Richard@Damon-Family.org> - 2018-12-31 17:16 -0500
          Re: [Solved] Need some help getting to my feet Bart <bc@freeuk.com> - 2018-12-31 22:44 +0000
            Re: [Solved] Need some help getting to my feet Ike Naar <ike@iceland.freeshell.org> - 2019-01-01 19:14 +0000
              Re: [Solved] Need some help getting to my feet rbowman <bowman@montana.com> - 2019-01-01 13:14 -0700
                Re: [Solved] Need some help getting to my feet Keith Thompson <kst-u@mib.org> - 2019-01-01 12:49 -0800
                Re: [Solved] Need some help getting to my feet rbowman <bowman@montana.com> - 2019-01-01 15:55 -0700
                Re: [Solved] Need some help getting to my feet Keith Thompson <kst-u@mib.org> - 2019-01-01 16:05 -0800
                Re: [Solved] Need some help getting to my feet rbowman <bowman@montana.com> - 2019-01-01 22:17 -0700
              Re: [Solved] Need some help getting to my feet Bart <bc@freeuk.com> - 2019-01-01 20:25 +0000

csiph-web