Notifications
Clear all

Coding help needed

41 Posts
6 Users
17 Likes
1,850 Views
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 

@frogandtoad Like I said, the subset G C I used the most had char varying. The OS for the hardware was written in PL1 and all the compilers were 3 stage types, so  the char varying just got carried over. They were able to implement new languages quickly due to the 3 stage architecture, and also chage hardware platforms quickly, during my 15ish years I saw old Motorola, PowerPC, HP Risc, Intel.

Just because you didn't encounter it doesn't mean it didn't exist. BTW, I am just saying it existed, I have no idea about standards, couldn't care less.

Like I said, we disagree.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@frogandtoad We will have to agree to disagree, I gave up on learning C++ because it was so complicated compared to C. If you think C++ is easier with more rules and syntax then our definitions of easy and hard are very different. Subject closed, we disagree.

It is not my own definition, it's recognised by many due to the nature of programming language evolution. C++ is a 3rd generation programming language, and thus a higher level language than C, and in turn, easier to learn, just as C is easier to learn than assembly, and assembly is easier to learn than direct machine language programming.

Posted by: @zander

I will check out the String class though in case I ever encounter a need for any of it as so far I have not.

But you stated that you never knew it had those features, how would you know what benefit you may have obtained had you known about them?

Posted by: @zander

I also welcome any more of your suggestions for generally/global use classes like String.

My suggestion is to use the String class everywhere you can in preference to C-Style strings (AKA character arrays), UNLESS there is a good reason not to use them.

Cheers


   
Inst-Tech reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 

@frogandtoad I have been using String(some-math-var) since I saw it used in a sketch. I just checked the sketches I have written as opposed to copied/modified and every variable so far is a bool or some size of int.

I just don't encounter the need for char arrays or Strings when reading/writing pins on an MPU.

Of course that doesn't mean I will not in the future and I thank you for pointing out the other member functions of String plus some new classes. BTW, where can I see the docs for those, keeping in mind I don't read so good since about 1975.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
Inst-Tech reacted
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@robotbuilder 

Posted by: @robotbuilder

@frogandtoad
I can't say I agree with that, because I for one want to know about everything and make personal improvement, even if I know I'll never end up in that field.

That is why in the next paragraph I wrote,

"However my impression was that some just want to code a few simple hardware projects using Arduino C++."

Indeed, I recognise that too, and that's why I say avoid learning C type tutorials, because C++ makes it easier for beginners.

Lets put it this way... the designers and implementer's of the Arduino framework and platform are extremely smart people, and as a team, they envisaged a platform so that the average person from a wide ranging audience could become involved in learning to use and program micro-controllers, and they chose to use C++ over C for a very good reason, by taking all of these arguments into account before settling on the language.

Without providing a language that supports all of those (and more) C++ objects I mentioned above, could you imagine how much harder it would be for newbies to work with micro-controllers in C only?  There would only be a small fraction of uptake into the world of programming the micro-controller.

Cheers


   
Inst-Tech reacted
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@frogandtoad I have been using String(some-math-var) since I saw it used in a sketch. I just checked the sketches I have written as opposed to copied/modified and every variable so far is a bool or some size of int.

I just don't encounter the need for char arrays or Strings when reading/writing pins on an MPU.

Of course that doesn't mean I will not in the future and I thank you for pointing out the other member functions of String plus some new classes. BTW, where can I see the docs for those, keeping in mind I don't read so good since about 1975.

Surely you use strings of some sort? 🙂

The "Help->Reference" will take you right there.

Cheers


   
Inst-Tech reacted
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@frogandtoad Like I said, the subset G C I used the most had char varying. The OS for the hardware was written in PL1 and all the compilers were 3 stage types, so  the char varying just got carried over. They were able to implement new languages quickly due to the 3 stage architecture, and also chage hardware platforms quickly, during my 15ish years I saw old Motorola, PowerPC, HP Risc, Intel.

Just because you didn't encounter it doesn't mean it didn't exist. BTW, I am just saying it existed, I have no idea about standards, couldn't care less.

Like I said, we disagree.

No, it's not about me or you...
I never said you didn't use it at all, I said it didn't exist in the C language.

And you should care about standards!

Anyway, you can easily prove me wrong if you find it (string data type) in your K&R book 😉

Cheers


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 

@frogandtoad I never looked at the String reference in detail, I saw the first page and recognized the syntax and didn't go down the page as I just did thanks to your prompting. Yes, In my biggest sketch I just did a search and String shows up twice, it's my LOG a msg function so I pass a String in and String a timestamp concatenated with the input string. That's it. My other smaller project has no strings of any kind.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 

@frogandtoad You are right, it didn't exist in the C language or K&R, but it did exist in the C compiler we used. The vendor added it since all the OS system calls used char_varying (the OS was written in PL1) in some ot the API calls. 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
frogandtoad reacted
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@frogandtoad I never looked at the String reference in detail, I saw the first page and recognized the syntax and didn't go down the page as I just did thanks to your prompting. Yes, In my biggest sketch I just did a search and String shows up twice, it's my LOG a msg function so I pass a String in and String a timestamp concatenated with the input string. That's it. My other smaller project has no strings of any kind.

All of those keywords, identifiers, types etc... that are listed on the reference page are links - Clicking on them is the best way to learn, as many of them provide small snippets of examples as well.

Cheers


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 

@frogandtoad Yes, I had done that in the past, but being the know-it-all I am thought I knew all about Strings so didn't in that case. I will endeavour to be more diligent when using the reference manual in the future. Examples are often the better way to learn at least for me. Just the other day I discovered that Serial had a lot more than just println and print. And just this very moment I now see that println has a formatting option that includes HEX!!!! I know that can be very useful for debug output. WOW, I am learning a lot this morning, time for a coffee with an extra large dose of coffee liquor to celebrate.

I mean it when I say I appreciate your efforts, but I remain convinced learning K&R C FIRST before diving into the much deeper pool of C++ is the best approach.

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@frogandtoad Yes, I had done that in the past, but being the know-it-all I am thought I knew all about Strings so didn't in that case. I will endeavour to be more diligent when using the reference manual in the future. Examples are often the better way to learn at least for me. Just the other day I discovered that Serial had a lot more than just println and print. And just this very moment I now see that println has a formatting option that includes HEX!!!! I know that can be very useful for debug output. WOW, I am learning a lot this morning, time for a coffee with an extra large dose of coffee liquor to celebrate.

Indeed, there is a lot of good information there for beginners, but many overlook the place where immediate help is available.

Posted by: @zander

I mean it when I say I appreciate your efforts, but I remain convinced learning K&R C FIRST before diving into the much deeper pool of C++ is the best approach.

Haha, no worries... you'll come around one of these days 😉

Goodnight


   
ReplyQuote
Page 3 / 3