- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
length4_fristNot at all sure what this piece of code is about. Is
length4an array of ranges? isrange(3, 1)legal? I was assuming that the parameters were the two end points of the range. Or isrange(x, y)some library function that applies to all collections, even ranges. That would makelength4[5]->range(...)make more sense.Admin
Work with code like this and you deserve a raise. /j
Admin
So we should use only cos() in the future?
Admin
I'd generally think that
length4[5]->range(0, 3)suggests that eitherlength4[5]->rangeis a function pointer orlength4[5]is a pointer to an object with a member function called range that takes two numbers as arguments. (It's implied to be C++, so the second interpretation is possible.)Admin
I'm confused. Do I cease sinning if I use Go or Forth?
Admin
Not only arrays, but arrays of arrays;
length4[5]->range(0, 3)seems to imply that there are at least 6 arrays of length 4 contained withinlength4and this range is for the first 3 elements of the sixth 4-length array. This definitely needs to get rewritten into structs while someone there still understands it.Admin
From the title I thought it was going to hold a NULL.
Admin
arrays in c++ don't have a range method, so they either subclassed it or it's their own struct or class. No arguments against the need for refactoring though
Admin
Go Forth && multiply (⋅,×).
Admin
If the submitter hadn't told us this was fresh C++ written as a one-time use "script", I'd have guessed that it started life in FORTRAN IV and been ported at least once, maybe 3 times, before it landed in C++ land.
Addendum 2026-09-23 08:49: Said another way, you can write FORTRAN in any language. ;)