On Tue, Nov 08, 2005 at 07:37:20PM -0500, Douglas McNaught was heard to remark: > > 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. No, that is not what "pass by reference" means. You are thinking of "const", maybe, or "pass by value"; this is neither. The arg is not declared const, the subroutine can (and usually will) modify the contents of the structure, and so the caller will be holding a modified structure when the callee returns (just like it would if a pointer was passed). --linas - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: typedefs and structs
- From: Kyle Moffett <mrmacman_g4@mac.com>
- Re: typedefs and structs
- From: Douglas McNaught <doug@mcnaught.org>
- Re: typedefs and structs
- References:
- typedefs and structs [was Re: [PATCH 16/42]: PCI: PCI Error reporting callbacks]
- From: linas <linas@austin.ibm.com>
- Re: typedefs and structs [was Re: [PATCH 16/42]: PCI: PCI Error reporting callbacks]
- From: Greg KH <greg@kroah.com>
- Re: typedefs and structs [was Re: [PATCH 16/42]: PCI: PCI Error reporting callbacks]
- From: linas <linas@austin.ibm.com>
- Re: typedefs and structs [was Re: [PATCH 16/42]: PCI: PCI Error reporting callbacks]
- From: Greg KH <greg@kroah.com>
- Re: typedefs and structs [was Re: [PATCH 16/42]: PCI: PCI Error reporting callbacks]
- From: linas <linas@austin.ibm.com>
- Re: typedefs and structs [was Re: [PATCH 16/42]: PCI: PCI Error reporting callbacks]
- From: Steven Rostedt <rostedt@goodmis.org>
- Re: typedefs and structs
- From: linas <linas@austin.ibm.com>
- Re: typedefs and structs
- From: Kyle Moffett <mrmacman_g4@mac.com>
- Re: typedefs and structs
- From: linas <linas@austin.ibm.com>
- Re: typedefs and structs
- From: Douglas McNaught <doug@mcnaught.org>
- typedefs and structs [was Re: [PATCH 16/42]: PCI: PCI Error reporting callbacks]
- Prev by Date: Re: typedefs and structs
- Next by Date: [PATCH] kernel: Replace kmalloc/memset with kzalloc.
- Previous by thread: Re: typedefs and structs
- Next by thread: Re: typedefs and structs
- Index(es):
![]() |