[lkml]   [2005]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: typedefs and structs
    linas <> writes:

    > On Tue, Nov 08, 2005 at 06:57:11PM -0500, Kyle Moffett was heard to remark:

    >> That technique tends to cause more problems than it solves. If I
    >> write the following code:
    >> struct foo the_leftmost_foo = get_leftmost_foo();
    >> do_some_stuff(the_leftmost_foo);
    >> How do I know what it is going to do?
    > It depends on how do_some_stuff() was declared. If its declared as
    > do_some_stuff (struct foo &x)
    > then it will be a pass by reference.

    Yeah, but if you're trying to read that code, you have to go look up
    the declaration to figure out whether it might affect 'foo' or not.
    And if you get it wrong, you get silent data corruption.

    I'd rather pass a pointer explicitly and crash with a segfault if
    someone passes NULL--at least then it's pellucidly clear what went

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-11-09 01:41    [W:0.024 / U:10.688 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site