Re: [riot-devel] About function pointers

2015-02-20 Thread Johann Fischer
Am Fri, 20 Feb 2015 08:01:58 +0100 schrieb Oleg Hahm oliver.h...@inria.fr: Was this a vote for a function pointer based HAL or just a Torvalds-like reflex? If the former is the case, then I'm apparently the only one - counting the silent people on this topic as agreeing or not caring -

Re: [riot-devel] About function pointers

2015-02-20 Thread Kaspar Schleiser
Hi, On 02/20/15 08:01, Oleg Hahm wrote: A bit polemic: can't we use Java then and rely on a highly optimized (micro) JVM? ;) Maybe the question here is if we should concentrate on gcc and clang and keep weird, esoteric, proprietary compilers that someone might use someday in an

Re: [riot-devel] About function pointers

2015-02-19 Thread Kaspar Schleiser
Hey, On 02/18/15 22:50, Oleg Hahm wrote: but we don't know which weird compilers on some esoteric hardware platform might be used for RIOT somewhere sometime, so I rather rely on optimized C code than on optimized compilers. this keeps popping up as an excuse not to do some elegant, readable,

Re: [riot-devel] About function pointers

2015-02-19 Thread ROUSSEL Kévin
Hello Oleg, Le 18/02/2015 23:16, Oleg Hahm a écrit : Hi Kévin! I began to use function pointers in the 'radio_driver.h' when trying to create a unified model for radio drivers. I guess it went over later to the whole netdev effort. Yes, I remember that, but why can't this be implemented in

Re: [riot-devel] About function pointers

2015-02-19 Thread Oleg Hahm
Hi Kaspar! On 02/18/15 22:50, Oleg Hahm wrote: but we don't know which weird compilers on some esoteric hardware platform might be used for RIOT somewhere sometime, so I rather rely on optimized C code than on optimized compilers. this keeps popping up as an excuse not to do some elegant,

[riot-devel] About function pointers

2015-02-18 Thread Oleg Hahm
Dear remodeling IoTlers! Ludwig just made me aware that Joakim's PR for NVRAM [1] introduces function pointers as part of the device driver struct. This made me remember that there were already similar function pointers introduced as part of netdev. As I was always opposed to use function

Re: [riot-devel] About function pointers

2015-02-18 Thread Ryan Kurte
Hi All, We use this approach exhaustively (for drivers and practically everything else) with the same result. The struct does not even need to be declared as a const struct if it is used in a way that implies such, though it is definitely more elegant to declare it so. Though I do have a

Re: [riot-devel] About function pointers

2015-02-18 Thread Oleg Hahm
Hi Pekka, thanks for your input. Of course, some care is needed to make sure that the compiler does the right thing. It is relatively easy to break the pattern. I see your point, but actually, I don't want to build a whole system model based on any assumption about what the compiler might

Re: [riot-devel] About function pointers

2015-02-18 Thread Oleg Hahm
Hi Kévin! I began to use function pointers in the 'radio_driver.h' when trying to create a unified model for radio drivers. I guess it went over later to the whole netdev effort. Yes, I remember that, but why can't this be implemented in a similar way we did for most of the peripheral drivers

Re: [riot-devel] About function pointers

2015-02-18 Thread Oleg Hahm
Hi Ryan! In my opinion this is a cleaner abstraction, and leads to clearer parallel composition (or wiring) of modules, rather than the oft used vertical composition. So, basically you're saying that trading some performance for a cleaner design is a good thing, is that right? I would say

Re: [riot-devel] About function pointers

2015-02-18 Thread ROUSSEL Kévin
Hello, I began to use function pointers in the 'radio_driver.h' when trying to create a unified model for radio drivers. I guess it went over later to the whole netdev effort. My idea then was to have a fast, predictable call chain from the MAC layer to the physical radio transceiver