Re:Object-oriented design patterns in C and kernel development
by 1718627440 on Thursday August 28, 2025 @01:24AM
(#45048699)
Having a stub or having a NULL pointer are two ways to leave something unimplemented. Which you use is an implementation detail. You can also use some other sigil instead of NULL.
[ Parent
| on HN ]
Re:Object-oriented design patterns in C and kernel development
by ryao on Thursday August 28, 2025 @07:45PM
(#45058302)
A stub is an empty implementation. An empty implementation is different from no implementation, where there is no code to execute. It is the difference between writing 0 and writing nothing.
Re:Object-oriented design patterns in C and kernel development
by 1718627440 on Friday August 29, 2025 @07:04AM
(#45062542)
If you care about this distinction, yes. However the LWN post describes how both can be used to implement the same behaviour, that their is no defined special implementation.
Re:Object-oriented design patterns in C and kernel development
by ryao on Friday August 29, 2025 @09:55AM
(#45064194)
I have no idea what LWN post you mean. You can make stubs trap by doing a NULL function pointer dereference, but that does not make NULL function pointer dereferences the same as stubs in general.
Re:Object-oriented design patterns in C and kernel development
by 1718627440 on Friday August 29, 2025 @04:07PM
(#45068800)
The LWN post the linked article is a comment to? I thought that's what we are discussing here? There are several paragraphs about exactly this issue.