|
First of all, C#, unless you use unsafe mode, does not give you direct access to pointer ops. I wouldn't qualify unsafe mode as simple C# stuff, particularly since you need full trust to run it. The fact that C# uses pointers under the covers is irrelevant. Every language does.
Second, everyone has to get educated at some point. There's no good reason that education wouldn't include a trip to Code Project.
Third, most of the people I worked with in bizdev knew little to nothing about pointers, particularly the front in web devs, and yet people are still willing to pay them.
Finally, not everyone does this for a job.
To err is human. Fortune favors the monsters.
|
|
|
|
|
honey the codewitch wrote: First of all, C#, unless you use unsafe mode, does not give you direct access to pointer ops. That's a machine level pointer. In C#, safe mode, a string is a pointer. We call them references there to not scare the kids.
honey the codewitch wrote: I wouldn't qualify unsafe mode as simple C# stuff, particularly since you need full trust to run it. The fact that C# uses pointers under the covers is irrelevant. Every language does. It's not; that's why they explain references and how they "stack" in every beginners course.
honey the codewitch wrote: Second, everyone has to get educated at some point. I know. I been a surgeon for two years now, and someday I need to learn what a liver is. Not like it's important straight away. I'll google it or ask on the forum if I get stuck.
honey the codewitch wrote: Turd, most of the people I worked with in bizdev knew little to nothing about pointers, Similar with the Access power user; or any VB user.
honey the codewitch wrote: Finally, not everyone does this for a job. I'm the one that entertains those questions on the forum. I'm the idiot that reminds people that homework is sometimes a legit ground to ask questions.
I'm here, to help others, for free. Not to tell them that it is homework. CodeProject is more about solving problems that non-coders have these days. I cannot help those, that would make me an unpaid non-employee
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Well for the record, what is inspiring me to write the article is that I'm getting a friend of mine involved in IoT development, and he knows just enough C++ to be dangerous. It's not his day job.
To err is human. Fortune favors the monsters.
|
|
|
|
|
honey the codewitch wrote: he knows just enough C++ to be dangerous. It's not his day job. "Not yet". And no need for an official education.
We'd have more surgeons if we treated them the same.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
It's a good thing you work mostly at night, because I think your friend is about to become your day job.
|
|
|
|
|
Well, he has a day job too, but he does some programming so I'm not starting from scratch.
To err is human. Fortune favors the monsters.
|
|
|
|
|
Said well.
Here is a C sample using pointers.
Using my rule of keeping pointers from being too saltly, I keep them at a somewhat controlled level
(this is mostly pseudo code so don't cry foul if you see syntax boo-boos
and/or use it and it crashes).
The point is pointers can be very powerful, but must be used with care and with restraint.
/* entry points for routines that do something */
extern int sub1();
extern int xyz();
extern int abc();
extern int subx();
/* put their addresses into a table */
...
struct { int (*action)() } cmd[] = {
sub1,
xyz,
abc,
subx
};
...
int execute_command( char *arguments )
{
int (*go)();
int err;
/* determine index i into the address table using whatever parsing is need to
identify the command intended by the user or the system
*/
go = (int (*)()cmd[i];
/* execute the routine selected by index i */
err = (*go)( arguments );
/* returns error code */
return( err );
}
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
This is just one way of many ways to slice the watermelon.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
I'm probably not going to get into jump tables in my article, but you'll be able to create them by building on the techniques I present.
To err is human. Fortune favors the monsters.
|
|
|
|
|
I am not C++ expert, but as I understand it, C is a subset of C++, ergo, anything you can do in C, one can do in C++. This might not be 100% true, but pointers for sure.
"A little time, a little trouble, your better day"
Badfinger
modified 18-Jun-22 19:37pm.
|
|
|
|
|
jmaida wrote: I am not C++ export I'm as much export as you.
How is it relevant that you are an export?
Assuming you know perpendicular lines, explain .NET without the term "reference".
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
fixed
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
You're fixed? How is that gonna help?
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I edited the post to fix typo.
Done
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
look forward to your article
diligent hands rule....
|
|
|
|
|
In 1980, I was introduced to pointers (by way of Pascal). They made perfect sense to me then as they do now.
/ravi
|
|
|
|
|
I was introduced to pointers using PL/I in grad school. Very cool language. Not quite as down and dirty as C, but the compiler general kept it clean. Amazing optimizing compiler and a great language syntax. Too bad it was IBM OS system language so proprietary at the time. C slowly became the go to language at the time for me. Pascal was very nice. Clean and clear. But I went the C route.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
I remember PL/1. My graduate CS program decided to instead use Pascal, and then switched to C. We're probably of the same vintage. I completed my MS (CS) degree in 1984.
/ravi
|
|
|
|
|
I completed my MS in 1978. (MSMCD) MS in Mathematics-Computer_Science-System_Design one of the first to offer a sort of triple major. The grad school was pretty young and small so they spread us around various faculty specialties to keep everyone busy. Loved it. It even included some courses in digital electronics. Did you do an wire-wrapping of circuits?
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
jmaida wrote: Did you do an wire-wrapping of circuits? Yes, because I transferred from an MS (Physics) program, I was required to take a few undergrad courses in digital circuit design. We were given a "breadboard in a suitcase" that included a PSU, clock, input switches and output LEDs, and our assignments were implemented as wire wrapped circuits on the suitcase. I have very fond memories of those days! Some of my most fun courses were Assembly Language and Compiler Construction I and II, and my Master's theses. (I got permission to do two because I was working under two professors.)
/ravi
|
|
|
|
|
Yup, we had similar experiences. We used a similar breadboard in a suit case product with similar I/O stuff. Compiler design was a favorite. Still use some the techniques in code, especially parsing user inputs. Did not do much actually assembly coding, but as part of the compiler design courses, we had to create our own assembly language and a simulator written in Fortran, running on a Data General Eclipse mini-computer (not so mini by today's std) about 1 computer rack in size, to execute it. Did many an all-nighter. Went from punch cards to dumb terminals to micro-computers. I worked in the same lab after graduating so my experiences there spanned into the early 80's. Good times indeed.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Looking forward. You have a knack at getting to the core of things. Thanx.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Thanks, I try. It's going to take me longer than usual it seems. It's a pretty involved topic, and I have to take breaks. It's not so much that it's long, but there are a lot of angles to cover and if I don't clear my head periodically I forget to include some.
To err is human. Fortune favors the monsters.
|
|
|
|
|
I agree.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
If you article includes C++ smart pointers you should include guidelines such as Herb Sutter's guidelines...
"If we don't change direction, we'll end up where we're going"
|
|
|
|