Click here to Skip to main content
15,887,027 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: I like C more than I thought I would Pin
Greg Utas15-Sep-22 1:22
professionalGreg Utas15-Sep-22 1:22 
GeneralRe: I like C more than I thought I would Pin
CPallini14-Sep-22 1:43
mveCPallini14-Sep-22 1:43 
GeneralRe: I like C more than I thought I would Pin
Mike Hankey14-Sep-22 2:27
mveMike Hankey14-Sep-22 2:27 
GeneralRe: I like C more than I thought I would Pin
Richard MacCutchan14-Sep-22 3:16
mveRichard MacCutchan14-Sep-22 3:16 
GeneralRe: I like C more than I thought I would Pin
megaadam14-Sep-22 7:12
professionalmegaadam14-Sep-22 7:12 
GeneralRe: I like C more than I thought I would Pin
honey the codewitch14-Sep-22 7:14
mvahoney the codewitch14-Sep-22 7:14 
GeneralRe: I like C more than I thought I would Pin
megaadam14-Sep-22 7:41
professionalmegaadam14-Sep-22 7:41 
GeneralRe: I like C more than I thought I would Pin
honey the codewitch14-Sep-22 7:46
mvahoney the codewitch14-Sep-22 7:46 
Yeah Haskell doesn't run everywhere or let me get close to the metal.

There's one easy instance I can think of for templates.

In IoT, when you wire up an LCD display, you need to tell your display library/driver what pins its using (and if the driver supports more than one type, what kind of display it is)

With a C app, you would have to set a bunch of defines, which can be done on the command line but is prohibitive when it comes to like 10 of them, leading a lot of people to create a "configuration" header that needs to be modified for one's project.

Worse, because of that, it only supports one display type at a time.

Templates allow for plugging in compile time constants all on a single line if desired, obviating the need for 10 #defines.

More importantly templates allow for statics that are local to the template instantiation allowing you to create static variables that are different for different pin assignments. This then allows you to run multiple displays.
To err is human. Fortune favors the monsters.

GeneralRe: I like C more than I thought I would Pin
pkfox14-Sep-22 10:22
professionalpkfox14-Sep-22 10:22 
GeneralRe: I like C more than I thought I would Pin
honey the codewitch14-Sep-22 10:31
mvahoney the codewitch14-Sep-22 10:31 
GeneralRe: I like C more than I thought I would Pin
Member 1330167914-Sep-22 23:26
Member 1330167914-Sep-22 23:26 
GeneralRe: I like C more than I thought I would Pin
honey the codewitch14-Sep-22 23:46
mvahoney the codewitch14-Sep-22 23:46 
GeneralRe: I like C more than I thought I would Pin
David O'Neil14-Sep-22 12:05
professionalDavid O'Neil14-Sep-22 12:05 
GeneralRe: I like C more than I thought I would Pin
jmaida14-Sep-22 15:38
jmaida14-Sep-22 15:38 
GeneralRe: I like C more than I thought I would Pin
David O'Neil14-Sep-22 15:53
professionalDavid O'Neil14-Sep-22 15:53 
GeneralRe: I like C more than I thought I would Pin
jmaida14-Sep-22 16:16
jmaida14-Sep-22 16:16 
GeneralRe: I like C more than I thought I would Pin
David O'Neil14-Sep-22 16:48
professionalDavid O'Neil14-Sep-22 16:48 
GeneralRe: I like C more than I thought I would Pin
jmaida14-Sep-22 17:10
jmaida14-Sep-22 17:10 
GeneralRe: I like C more than I thought I would Pin
den2k8814-Sep-22 20:55
professionalden2k8814-Sep-22 20:55 
GeneralRe: I like C more than I thought I would Pin
David O'Neil14-Sep-22 21:16
professionalDavid O'Neil14-Sep-22 21:16 
GeneralRe: I like C more than I thought I would Pin
den2k8814-Sep-22 21:19
professionalden2k8814-Sep-22 21:19 
GeneralRe: I like C more than I thought I would Pin
Member 1330167915-Sep-22 0:00
Member 1330167915-Sep-22 0:00 
GeneralRe: I like C more than I thought I would Pin
David O'Neil15-Sep-22 6:21
professionalDavid O'Neil15-Sep-22 6:21 
GeneralRe: I like C more than I thought I would Pin
inlandchris114-Sep-22 21:34
inlandchris114-Sep-22 21:34 
GeneralRe: I like C more than I thought I would Pin
honey the codewitch14-Sep-22 22:14
mvahoney the codewitch14-Sep-22 22:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.