POV-Ray : Newsgroups : povray.off-topic : c++ template types for function : Re: c++ template types for function Server Time
20 Oct 2021 12:53:29 EDT (-0400)
  Re: c++ template types for function  
From: Bald Eagle
Date: 30 Apr 2020 14:45:00
Message: <web.5eab1c1cce0a4398fb0b41570@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> no C++, but in C I'd create an array of a union of float + bool.

I think for my purposes, c and c++ are similar enough to "be the same".
{GASP!}  {Sacrilege!}  "Thou hast besmirched the pedantic purity of the names!"}


Could you possibly write a little example of that in C so I can see how it
works?


I also have a hardware address hard-coded into a .h file which prototypes the
functions that interact with the hardware.
The problem I have is that I need at least 2 different sensors, which will have
different addresses once I switch one on the solder pad.  I can do a max of 4.

Should I have 4 different .h files?
Should I have 4 differently named constructors IN the .h file?

I'm also confused about the associated .cpp file.  That's the one that actually
has the functions defined in it, so how does #include <filename.h> access what's
in filename.cpp if there's no #include <filename.cpp> in filename.h?
Is it just an internal thing to the IDE that automatically includes any
similarly named .cpp file if a .h file is included?

So much to learn.  ;)


Post a reply to this message

Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.