319
submitted 1 year ago* (last edited 1 year ago) by ashishlotake@mastodon.social to c/linux@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] eager_eagle@lemmy.world 24 points 1 year ago* (last edited 1 year ago)

Unless they're indices, do yourself a favor and use meaningful names instead.

I avoid index iterations the most I can tbh. And for nested loops,i and k is more readable.

[-] fidodo@lemm.ee 11 points 1 year ago

Even for indexes I do index or something more specific for what it's indexing. Any simple iteration I just do map or each so the only time I ever need to actually index things is for more complex scenarios in which case it's worth it to have better names. Also with modem IDEs, auto complete is really good so you don't need to write a full variable name more than once.

[-] reverendsteveii@lemm.ee 5 points 1 year ago

When I was a baby coder back in the 90s we were taught that these names were meant to save space in the symbol table because at one time space was so limited that naming your variable n rather than numElementsInArray would have an impact

[-] tkarika@lemmy.world 4 points 1 year ago

This is the way.

this post was submitted on 26 Aug 2023
319 points (88.4% liked)

Linux

48655 readers
519 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS