User: Password:
|
|
Subscribe / Log in / New account

Object-oriented design patterns in the kernel, part 2

Object-oriented design patterns in the kernel, part 2

Posted Jun 8, 2011 13:21 UTC (Wed) by nix (subscriber, #2304)
In reply to: Object-oriented design patterns in the kernel, part 2 by jzbiciak
Parent article: Object-oriented design patterns in the kernel, part 2

Oh no. What Ritchie described *was* unwarranted chumminess with the implementation, because you're declaring a short array then allocating more space and walking off the end of it. That *is* forbidden by the Standard. But allocating enough space for one structure appended to the end of another one, then doing pointer addition and a typecast? That's allowed: you're not accessing off the end of one object at all, you're accessing the object you cast to.


(Log in to post comments)


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds