Strings or woodwinds?

I know this is in NOT the proper place to talk business, but I figured as long as I won't talk about “blinking LED's” I may get away with it.

Life long experience has taught me to express myself as precise, accurately as feasible; excluding my English language usage of course.

So why are “coders” almost always refer to “string(s)” when they are talking about (eventually) receiving char(racters) into char array?

It leads to misconceptions.
C is “strongly typed “ language and “string(s)” is not one of them.
And C is “case sensitive” and “String” and “string” are different as far as C is concerned.

Off my soap box.
Vaclav

Vaclav:
I know this is in NOT the proper place to talk business, but I figured as long as I won't talk about “blinking LED's” I may get away with it.

Life long experience has taught me to express myself as precise, accurately as feasible;

Here, you wander into the brass section. It's called 'blowing your own trumpet'. :smiley:

It seems people here are saying 'string' to emphasize the fact they aren't using the Arduino class 'String', however a character array ( with a null terminator ) in the C/C++ world is called a C-style string, and commonly known simply as a cstring.

It doesn't lead to misconceptions because it's common practice to refer to a null-terminated array of char as a string.

We refer to bytes and that's not an official type.

These (and probably other) terms are just shorthand or jargon.

Maybe it confuses beginners but so what, the whole damn language confuses most people :slight_smile:


Rob

I feel like you should avoid ambiguity when possible, but also be willing to glean from context when you can.

People refer to "strings" as in, a "string of characters". Or, Strings as an object of type String. Not everyone gets the capitalization correct, but you can generally tell. If I talk about "char name[]" as a string, you know what I mean. Stopping a conversation to point out that it is in fact an array of char is just pointlessly anal, unless there is a real chance the offender doesn't understand the difference and might appreciate being made aware.

Same goes for other abbreviations. You don't talk about file sizes in megabits, so a 10mb file is clearly 10 megabytes. My cable modem connection is 20mb -- that is, megabits, because that's the convention for bandwidth. If I wanted to be correct (and I usually do), I would write Mb or MB, but I won't derail a thread to point out an inconsistency when I know darn well what someone meant. (And I definitely won't hassle someone over whether it should've been MiB or Mib instead. The difference rarely matters in typical context. When it does, clarify.)

Someone on another forum posted a reply to point out that a "tick every xx uS" is improper, as ticks are not expressed in micro-Siemens, nor micro-Samples, but micro-seconds. Good for you. Can we get on with the topic now? :roll_eyes:

In short, try to be clear. Likewise, try to be tolerant. If you genuinely can't tell -- ask. (Unless you write technical documentation. Then, it's your job -- you should try to get it right.)

Var
YourString: String;

YourString [1]:='A';

Now under pascal what determines the endpoint is the null char / #0

Exactly the same in C, except it's no where near type casted as pascal but... Strings have always been strings if they consist of an array of characters, well before object oriented programming existed...

I hate all objective forms of variables.. eg mystring.concat (just wrong) including the 'string' class in Arduino, I bet the string object was there to help beginners no doubt but created more problems in the long term.

Its primary purpose is to prevent the trouble programmers get into when neglecting the terminating null, overflowing buffers, things like that. It also makes it more like other data types that can be processed with various operators, whereas strings (lower-case 's') require function calls.

Pointers and terminating nulls are responsible for a great deal of software bugs. Avoid those, and you eliminate a lot of opportunity for error. (Although, you also miss out on some of the cool stuff that C lets you do.)