<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>C and C++ are very close. C is more basic and C++ has a lot of
features to deal with objects. If you look at embedded C++ code it
mostly C code wrapped in C++ classes.<br>
</p>
<p>The &, * and ** aren't that hard. Another thing to ad to the
list is ->.</p>
<p>One of the things you do to reduce memory usage and speed things
up is to use the address of a variable, structure or array which
is called a pointer. Passing the address of something around you
don't have to use memory to make copies of stuff which uses more
memory and copy stuff to the new memory area which takes time.
Another time to use pointers is passing data into routines that
you want to change, example below.<br>
</p>
<p>So the & means take the address of something and the * says a
variable is a pointer. Then the ** is a pointer to a pointer.<br>
</p>
<p>int iData; /* Variable called data size int */<br>
int *ptriData = &iData; /* Address of iData is put into
ptriData */<br>
int **ptrptriData = &ptriData; /* Address of ptriData put
into ptrptriData */<br>
</p>
<p>/* To access stuff. */<br>
*ptriData = 8;<br>
**ptrptriData = 8; /* Same as above */<br>
iTemp = *ptriData + 10;</p>
<p>/* Routine call */<br>
int<br>
specialRoutine(<br>
int *ptrToSomething, /* Pointer to something you want to change
*/<br>
int justData /* Just a number that is not changed */<br>
)<br>
{<br>
*ptrToSomething = 42 + (justData / 3);<br>
return( NO_ERROR );<br>
}</p>
<p>-> is used when you use pointers to structures. I'll let you
figure that one out.</p>
<p>Notice I used iData for an int, this is called Hungarian notation
where you embed the data type in the variable name. A lot of
people don't like it, I can see that for regular applications but
I use it in true embedded applications since data type/size is
more important. Might check into it to see if it would help you
out.</p>
<p>There are newer data type definitions that aren't in a lot of the
older books that I would suggest using too. These are in the form
of in16_t, uint32_2 and are defined in the header file stdint.h.<br>
<a class="moz-txt-link-freetext" href="https://www.gnu.org/software/libc/manual/html_node/Integers.html">https://www.gnu.org/software/libc/manual/html_node/Integers.html</a></p>
<p>Good luck.<br>
Jay S.<br>
</p>
<div class="moz-cite-prefix">On 12/3/2020 11:18 PM, Shawn Rakestraw
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CA+-UNiDTCjkLsVG800=2Y4LCUFMP3-xSByOiw8zmoio14Wtb3w@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">Thanks Jay, I actually installed a VirtualBox with
Ubuntu tonight and started learning C. It is a lot like C++.
Hopefully I can pick up on the basics of it pretty quick. At the
moment I have been a little confused about the * and ** next to
variable names. Also the & variable names. I found some
resources about it and realize they indicate pointers or
something. I'm just not following the reason to have a pointer
instead of the variable. I'm sure it will become clear as I
continue to learn. </div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Dec 3, 2020, 3:11 PM
Jay Schwichtenberg <<a href="mailto:jschwich53@comcast.net"
moz-do-not-send="true">jschwich53@comcast.net</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<p>I was an embedded/bare metal HW/SW engineer and will say
working with embedded ARM uCs C.</p>
<p>C++ usually complicates things and is overkill for run of
the mill embedded stuff. Don't know if it is still true
but at one time the C++ libraries had a lot of bloat and
took up a lot of storage. I've also found C++ harder to
debug when people start overloading and abstracting
things.<br>
</p>
<p>If you do need to run object based code you can in C.
Take all the data for an object and put it into a
structure and then pass a pointer to the structure around
through the code. This is more or less the equivalent of a
'this structure' that objects have in C++. The data is
isolated to a single object and just use a new structure
with different data for another object. Also follow C++
and make you own constructors and destructors to setup and
shutdown things.</p>
<p>Jay S.<br>
</p>
<div>On 12/2/2020 6:45 PM, Shawn Rakestraw wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Please don't go into extreme detail (unless you
really want to). I ask too many simple questions and I
feel bad that everyone spends great amounts of time
with it.</div>
<div><br>
</div>
<div>I am thinking about programming ARM chips like the
STM32 for something like Braids. I know that I will
not be making my own Braids module anytime soon, but I
would like to start thinking about the language I need
to learn. I know the most about C++. I also realize
that my question may be better asked as what libraries
should I load / study up on.</div>
<div><br>
</div>
<div>Thanks guys/gals<br>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
Synth-diy mailing list
<a href="mailto:Synth-diy@synth-diy.org" target="_blank" rel="noreferrer" moz-do-not-send="true">Synth-diy@synth-diy.org</a>
<a href="http://synth-diy.org/mailman/listinfo/synth-diy" target="_blank" rel="noreferrer" moz-do-not-send="true">http://synth-diy.org/mailman/listinfo/synth-diy</a>
Selling or trading? Use <a href="mailto:marketplace@synth-diy.org" target="_blank" rel="noreferrer" moz-do-not-send="true">marketplace@synth-diy.org</a>
</pre>
</blockquote>
</div>
_______________________________________________<br>
Synth-diy mailing list<br>
<a href="mailto:Synth-diy@synth-diy.org" target="_blank"
rel="noreferrer" moz-do-not-send="true">Synth-diy@synth-diy.org</a><br>
<a href="http://synth-diy.org/mailman/listinfo/synth-diy"
rel="noreferrer noreferrer" target="_blank"
moz-do-not-send="true">http://synth-diy.org/mailman/listinfo/synth-diy</a><br>
Selling or trading? Use <a
href="mailto:marketplace@synth-diy.org" target="_blank"
rel="noreferrer" moz-do-not-send="true">marketplace@synth-diy.org</a><br>
</blockquote>
</div>
</blockquote>
</body>
</html>