signal11 / m-stack

Free USB Stack for PIC 16F, 18F, 24F, and 32MX Microcontrollers
http://www.signal11.us/oss/m-stack/
Other
183 stars 94 forks source link

inconsistency in usage of usb_start_receive_ep0_data_stage() #10

Closed hughsie closed 9 years ago

hughsie commented 9 years ago

In the various programs in m-stack there are two different ways usb_start_receive_ep0_data_stage() is being used:

usb_start_receive_ep0_data_stage(buf,len,func_cb,userdata);

and

usb_start_receive_ep0_data_stage(buf,len,&func_cb,userdata);

I don't think it matters to the xc8 compiler, but it does feel a bit odd to rely on this undocumented compiler quirk.

Richard

signal11 commented 9 years ago

It's not an undocumented quirk, it's C. Both are correct. Remember also that m-stack works on more than just xc8.

See the first few links at: https://www.google.com/search?q=ampersand+function+pointer

hughsie commented 9 years ago

Hah, I've learned something new today. Sorry for the noise! :)

signal11 commented 9 years ago

No worries