Plug-ins, Hosts, Apps,
Hardware, Soundware
Developers
(Brands)
Videos Groups
Whats's in?
Banks & Patches
Download & Upload
Music Search
KVR
   
KVR Forum » DSP and Plug-in Development
Thread Read
the value of C++ in DSP work
Goto page Previous  1, 2, 3
eigentone
KVRist
- profile
- pm
PostPosted: Thu Apr 05, 2012 9:33 am reply with quote
mystran wrote:
eigentone wrote:

Quote:
the difference between a c++ struct and a c++ class is that (edit: actually what is the difference?).


default access (class default=private, struct default=public). that's all.


One gotcha to be aware of though: if you forward declare something as a class, it must be a class and not a struct. Likewise if you forward declare something as a struct, it must be a struct and not a class. So in some sense they are still "distinct" even if their implementation is the same and you can freely mix them in inheritance chains.


while some compilers permit it, and may issue a warning (when visible in the TU).
^ Joined: 03 Apr 2007  Member: #146135  
mystran
KVRAF
- profile
- pm
- e-mail
- www
PostPosted: Thu Apr 05, 2012 9:45 am reply with quote
eigentone wrote:
mystran wrote:
eigentone wrote:

Quote:
the difference between a c++ struct and a c++ class is that (edit: actually what is the difference?).


default access (class default=private, struct default=public). that's all.


One gotcha to be aware of though: if you forward declare something as a class, it must be a class and not a struct. Likewise if you forward declare something as a struct, it must be a struct and not a class. So in some sense they are still "distinct" even if their implementation is the same and you can freely mix them in inheritance chains.


while some compilers permit it, and may issue a warning (when visible in the TU).


Yeah, but other compilers fail hard, so you shouldn't really ever do it anyway.
----
<- my plugins | my music -> @Soundcloud
^ Joined: 11 Feb 2006  Member: #97939  Location: Helsinki, Finland
eigentone
KVRist
- profile
- pm
PostPosted: Thu Apr 05, 2012 10:00 am reply with quote
mystran wrote:
eigentone wrote:
mystran wrote:
eigentone wrote:

Quote:
the difference between a c++ struct and a c++ class is that (edit: actually what is the difference?).


default access (class default=private, struct default=public). that's all.


One gotcha to be aware of though: if you forward declare something as a class, it must be a class and not a struct. Likewise if you forward declare something as a struct, it must be a struct and not a class. So in some sense they are still "distinct" even if their implementation is the same and you can freely mix them in inheritance chains.


while some compilers permit it, and may issue a warning (when visible in the TU).


Yeah, but other compilers fail hard, so you shouldn't really ever do it anyway.


agreed. i just use class everywhere, and this problem sprouts up rarely (e.g. when interfacing with different 3rd party distributions).
^ Joined: 03 Apr 2007  Member: #146135  
All times are GMT - 8 Hours

Printable version
Page 3 of 3
Goto page Previous  1, 2, 3
Display posts from previous:   
ReplyNew TopicPrevious TopicNext Topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Username: Password:  
KVR Developer Challenge 2012