I'm Lost... again.

Try as I can something in this single line just doesn't make sense to me, or work for that matter.
tlcd.print(static_cast(hour + 7)); tlcd.print(":"); tlcd.print(static_cast(minute));
Where did I miss it in the books, I try hard not to waste time here If I can avoid it...
I know what both terms are, more or less but why a static cast inside a function when the data changes outside of
the function once a second. GPS Time is being displayed here, and a 2 second delay after the function ends before the closing brace.

Doc

static_cast is not useful in this situation. You just need a standard c-style cast if taking a 16-bit int to an 8-bit int ( hour + 7 ), and no cast required if going to a larger datatype.

is there a reason why you put the cast in?? I presume hour and minute are integer types.

EDIT: re-read and it seems this may not be your code ( reading thru someone else's ). but that static_cast is about as useful as this.

static_cast< void >( Serial.read() );

This does absolutely nothing apart from points out to someone reading/modifying the code that you have intentionally dropped a return value. On critical systems practices like this are used widely.

Casts should be used as a last resort, and not as something you routinely put into printing data like you are.

Surely this looks messy:

tlcd.print(static_cast<int>(hour + 7)); 
tlcd.print(":");
tlcd.print(static_cast<int>(minute));

Compared to:

tlcd.print(hour + 7); 
tlcd.print(":");
tlcd.print(minute);

Or even, if you can serialize:

tlcd << (hour + 7) << ":" << minute;

Something about casts here:

From that page:

  1. Casts are bad. Every cast is a potential design problem. Some are unavoidable, some are just fine, but every single one must be considered carefully. Hopefully, writing the full operator makes you think harder about using the cast.

You really should be thinking not "how do I cast this and get it to compile?" but rather "why do I have to cast this in the first place?".

That is similar to my thoughts much better organized though. Thank you for some verification of my learning...
No I was looking at a sketch from another contributor that looked easier to convert to an LCD module as that was why I boughta gps unit, cheap accurate always on time keeping, this and some more functions to be combined for my little bedside look at the world a weather station, clock and X10 controls blended carefully with some of those cheap nRF24XX series modules and an 8 digit 3208 scrolling display for casual time display will be all included and a 3.2" touch screen to control most of it it will monitor a car and my garage as well... for now. Mostly a project to keep an old man busy, learning and doing after I retired. That was my single challenge to keep busy at something I love... dearly. I do thank you for your help as the language is very new to me, I read a lot and that 'line' really jumped off the screen when I tried to figire out why it didn't work, that after all is half the learning. IMO

Doc

Great line you wrote LOL...
static_cast< void >( Serial.read() ); I liked to fell out of my chair laughing at that one, almost as funny as IMO the real answer for the old saw about the shortest C program...
Real answer is who cares... like your answer... what good is it?
A 'cast' is a fix or bandaid more than anything else??? no? least used the better?

Doc

pYro_65:
that static_cast is about as useful as this.

static_cast< void >( Serial.read() );

Oh, yeah, I see what you mean!

void setup ()
{
  int i;
  
  static_cast <void> (i = static_cast <int> (1) + static_cast <int> (1));
}
void loop () {}

Or you could write:

void setup ()
{
  int i;
  
  i = 1 + 1;
}
void loop () {}

Or maybe:

void setup ()
{
  int i = 2;
}
void loop () {}

Or is that just over-egging the pudding?