pmodJSTK cpp declaration question

Post Reply
Posts: 69
Joined: Sat Mar 28, 2015 4:45 am
Location: Quebec - Canada

pmodJSTK cpp declaration question

Post by FredCailloux » Tue Feb 09, 2016 4:39 pm

Here is a part of example cpp code for the pmodJSTK:

Code: Select all

#include "JSTK.h"
extern "C" {    #include <stdint.h>  }
/* Joystick Driver Object Instantiation - Instantiate a single static instance of this object class */
JSTK::JSTK() { }
I am mostly concentrated on the as a learning source for C++ and in there it is shown that a Class definition is first defined in the header file (which is the case for this pmodJSTK example). It is also though that a Class::Class line does not require to be redefined in it's .cpp code definition if no initiation actions are required.
Question: The code above show clearly the JSTK::JSTK() { } line and no further actions are programmed.
Why is this line of code present ? What does it do ? Could it be omitted ?

Thanks for your input
Prashant Tripathi :idea: Knowing is to the Self what knowledge is to the ego

User avatar
Site Admin
Posts: 2187
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK

Re: pmodJSTK cpp declaration question

Post by majenko » Tue Feb 09, 2016 7:58 pm

It's probably there because it was automatically put in by a class constructor plugin for an IDE, or because the author does it automatically without thinking.

If you don't explicitly create an empty constructor like that then one is created for you.
Why not visit my shop?
Universal IDE:
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Post Reply