On 4/8/2026 4:22 AM, Janis Papanagnou wrote:
No necessity for peeking since I'd write a Unix 'sort' one-liner
(instead of a bulky "C" program). ;-)
Bulky C is more fun!
"one-liner"? With multiple pipes and tr and sed and awk, maybe.
Honestly; mind to explain what the point of this "C" challenge is?
Sure thing: "Print first last (as shown above) but ordered by last first."
[...]
Bart <[email protected]> writes:
On 08/04/2026 17:25, DFS wrote:
On 4/8/2026 4:22 AM, Janis Papanagnou wrote:
//count characters in a string
int countchr(char *str, char chr)
{int c=0,cnt=0;while(str[c]!='\0'){if(str[c]==chr){cnt++;}c++;}return
cnt;}
I couldn't quite figure out what it did; counting characters in a string
(like the comment says)? But strlen will do that. Then I noticed that
the extra 'chr' parameter, so maybe it stops at 'chr'.
But when I tried running it as countchr("ABCDEFGH", 'E'), it returned 1,
not 4 or 5.
So I refactored it like this:
int countchr(char *str, char chr) {
int c=0, cnt=0;
while (str[c]!='\0') {
if (str[c] == chr) cnt++;
c++;
}
return cnt;
}
Idiomatically, I might have written
size_t
countchar(const char *str, char match)
{
size_t count = 0u;
for(; *str != '\0'; str++) count += (*str == match);
return count;
}
[...]
And I notice I didn't specify the output format. I want it to look like this:
Ron Lauzon
Wenfeng Liang
Brendan Long
Jacob Lyles
Jim McCloskey
Mordant
Mike Nichols
Michael Nygard
Malcolm Ocean
Doug Phillips
Mark Ping
[...]
On 2026-04-08 23:13, DFS wrote:
[...]
And I notice I didn't specify the output format. I want it to look
like this:
In article <[email protected]>,
Michael S <[email protected]> wrote:
On Wed, 08 Apr 2026 23:35:35 GMT
[email protected] (Scott Lurndal) wrote:
Michael S <[email protected]> writes:
On Wed, 08 Apr 2026 21:04:56 GMT
[email protected] (Scott Lurndal) wrote:
[snip]
Idiomatically, I might have written
size_t
countchar(const char *str, char match)
{
size_t count = 0u;
for(; *str != '\0'; str++) count += (*str == match);
return count;
}
I'd change it to
size_t
countchar(const char *str, char match)
{
size_t count = 0;
for(; *str != 0; str++) count += (*str == match);
return count;
}
Personally, I prefer to properly identify integer constants
with the appropriate type annotation. I always explicitly
check against NULL rather than using !ptr, for example. I
never use an unadorned integer for a character constant,
rather using either 'c' for printables, the legal escapes
(e.g. \n) and for any non-printable, the appropriate
octal escape.
Perhaps some of this is pedantic. I worked with a system
where the null pointer constant was not the value zero, so
I'm aware that !ptr may not actually do the right thing in
such cases.
Which is irrelevant in this specific case.
BTW, I think that (ptr != 0) is guaranteed to work even on systems
with null pointers not being numerically zero. But I am not
certain about it. What I am certain is that on the right side of
assignment to pointer 0 always acts the same as NULL.
But that's too irrelevant for our case.
It's easy enough to verify looking at a canonical source.
Section 6.3.2.3 coupled with 6.5.9 of C18 suggest this is
guaranteed to work.
As to being pedantic w.r.t. '\0', may be you acquired this habit
because of C++? If I am not mistaken, in C++ '\0' has type char
and due to that (or because of, which is IMHO, more appropriate
wording) can in some contexts lead to results different from 0,
with differences as huge as call to completely different procedure.
It does not happen in C where we have no misfeature of type based
static polymorphism.
'\0' is indeed a `char` in C++. But I don't think that really
changes the point, which is more about semantics. Why NOT use a
relevant character constant instead of `0`? It's not whether
one can or not, or whether it's semantically equivalent, or
whether C's `char` type is really an integer in a trenchcoat:
it's using the appropriate constant to match the domain: in this
case, matching character data.
Martin Hohenberg, Jae Yang, Tim Bando, Daniel Garber, Kyle Burkholder,
Mike Nichols, Mark Ping, Tom Taylor, Arnold F. Williams, George
Brower, Michael Nygard, Brendan Long, Sven Dowideit, Dave Witten,
Jonathan Cast, James Cronin, David L. Jessup, Christopher Chang,
Killer Delicious, Jacob Lyles, Neil Anuskiewicz, Mordant, Clemens
Ladisch, Wojciech Woytniak, Masa Bando, John Carmack, Xingyu Wang,
Jane Tang, Steven Evans, Jan Roudaut, Hsueh Sung, Ken LaCrosse,
taishi28012, John Simpson, Jerod Tufte, Paul Abbott, Stan Witherspoon, Donald Greer, Gratiela Chergu, Michael Ciagala, Dale Carstensen, Chip
Davis, Liudmilla Karukina, Jim McCloskey, Dewey Sasser, Hal
Hildebrand, Connor Wood, Ken Kennedy, darrin, Mark Gardner, William Christensen, Malcolm Ocean, Rod Davenport, Nodarius Darjania, Cheryl
Evry, Wenfeng Liang, Irving Rivas, Bill Soistman, ReallyBored, Άρης Δάσος, Ron Lauzon, TheFred, Paul Theodoropolous, Doug Phillips, Les Vogel, Matt Pollard, Andres Cordova
Print first last (as shown above) but ordered by last first.
[email protected] (Dan Cross) writes:
In article <[email protected]>,
Michael S <[email protected]> wrote:
On Wed, 08 Apr 2026 23:35:35 GMT
[email protected] (Scott Lurndal) wrote:
Michael S <[email protected]> writes:
On Wed, 08 Apr 2026 21:04:56 GMT
[email protected] (Scott Lurndal) wrote:
[snip]
Idiomatically, I might have written
size_t
countchar(const char *str, char match)
{
size_t count = 0u;
for(; *str != '\0'; str++) count += (*str == match);
return count;
}
I'd change it to
size_t
countchar(const char *str, char match)
{
size_t count = 0;
for(; *str != 0; str++) count += (*str == match);
return count;
}
Personally, I prefer to properly identify integer constants
with the appropriate type annotation. I always explicitly
check against NULL rather than using !ptr, for example. I
never use an unadorned integer for a character constant,
rather using either 'c' for printables, the legal escapes
(e.g. \n) and for any non-printable, the appropriate
octal escape.
Perhaps some of this is pedantic. I worked with a system
where the null pointer constant was not the value zero, so
I'm aware that !ptr may not actually do the right thing in
such cases.
Which is irrelevant in this specific case.
BTW, I think that (ptr != 0) is guaranteed to work even on systems
with null pointers not being numerically zero. But I am not
certain about it. What I am certain is that on the right side of
assignment to pointer 0 always acts the same as NULL.
But that's too irrelevant for our case.
It's easy enough to verify looking at a canonical source.
Section 6.3.2.3 coupled with 6.5.9 of C18 suggest this is
guaranteed to work.
As to being pedantic w.r.t. '\0', may be you acquired this habit
because of C++? If I am not mistaken, in C++ '\0' has type char
and due to that (or because of, which is IMHO, more appropriate
wording) can in some contexts lead to results different from 0,
with differences as huge as call to completely different procedure.
It does not happen in C where we have no misfeature of type based
static polymorphism.
'\0' is indeed a `char` in C++. But I don't think that really
changes the point, which is more about semantics. Why NOT use a
relevant character constant instead of `0`? It's not whether
one can or not, or whether it's semantically equivalent, or
whether C's `char` type is really an integer in a trenchcoat:
it's using the appropriate constant to match the domain: in this
case, matching character data.
There's no reason to use a constant at all; just write '*str'.
This writing isn't just idiomatic -- it's integral to how the
language was designed, not only for string termination but also
the rules for null pointers and how expressions work in the
context of for(), if(), and while(). Writing != 0 or != '\0' is
a holdover from being used to writing Pascal (or any number of
other earlier languages).
When in Rome, do as the Romans do.
Keith Thompson <[email protected]> writes:
Tim Rentsch <[email protected]> writes:
[...]
The semantics of !ptr has been codified to mean 1 for null pointers
since the original C standard. Heck, even during the 1970s when C
allowed assigning integers directly to pointers, K&R said that
assigning 0 to a pointer produces a pointer guaranteed to be
different than a pointer to any object. Any C implementation where
!ptr does the wrong thing should be avoided like the plague.
Any C implementation where !ptr does the wrong thing almost certainly
does not exist. It's difficult to imagine that a C compiler with
such a fundamental bug would ever go out the door.
It's barely possible that compiler that uses a representation other
than all-bits-zero for null pointers might have such a bug, but
(a) anyone creating such an implementation will almost certainly
be extremely careful to get such things right, and (b) I'm not sure
that any such compilers even exist, except perhaps for old systems
that would be considered exotic today.
Or even obsolete. The systems in question were all retired by
2010, and never had a C compiler. The system was BCD and the
six digit 'undigit' value of EEEEEE was chosen as the NIL (NULL)
pointer value.
Tim Rentsch <[email protected]> writes:
[...]
The semantics of !ptr has been codified to mean 1 for null pointers
since the original C standard. Heck, even during the 1970s when C
allowed assigning integers directly to pointers, K&R said that
assigning 0 to a pointer produces a pointer guaranteed to be
different than a pointer to any object. Any C implementation where
!ptr does the wrong thing should be avoided like the plague.
Any C implementation where !ptr does the wrong thing almost certainly
does not exist. It's difficult to imagine that a C compiler with
such a fundamental bug would ever go out the door.
It's barely possible that compiler that uses a representation other
than all-bits-zero for null pointers might have such a bug, but
(a) anyone creating such an implementation will almost certainly
be extremely careful to get such things right, and (b) I'm not sure
that any such compilers even exist, except perhaps for old systems
that would be considered exotic today.
[email protected] (Scott Lurndal) writes:
Or even obsolete. The systems in question were all retired by
2010, and never had a C compiler. The system was BCD and the
six digit 'undigit' value of EEEEEE was chosen as the NIL (NULL)
pointer value.
It would be nice if in the future it were stated directly when a
non-C environment is the context of a comment. I mistakenly
understood that what you were saying had to do with experience
using some unusual C compiler.
On 2026-04-08 05:14, DFS wrote:
Martin Hohenberg, Jae Yang, Tim Bando, Daniel Garber, Kyle Burkholder,
Mike Nichols, Mark Ping, Tom Taylor, Arnold F. Williams, George
Brower, Michael Nygard, Brendan Long, Sven Dowideit, Dave Witten,
Jonathan Cast, James Cronin, David L. Jessup, Christopher Chang,
Killer Delicious, Jacob Lyles, Neil Anuskiewicz, Mordant, Clemens
Ladisch, Wojciech Woytniak, Masa Bando, John Carmack, Xingyu Wang,
Jane Tang, Steven Evans, Jan Roudaut, Hsueh Sung, Ken LaCrosse,
taishi28012, John Simpson, Jerod Tufte, Paul Abbott, Stan Witherspoon,
Donald Greer, Gratiela Chergu, Michael Ciagala, Dale Carstensen, Chip
Davis, Liudmilla Karukina, Jim McCloskey, Dewey Sasser, Hal
Hildebrand, Connor Wood, Ken Kennedy, darrin, Mark Gardner, William
Christensen, Malcolm Ocean, Rod Davenport, Nodarius Darjania, Cheryl
Evry, Wenfeng Liang, Irving Rivas, Bill Soistman, ReallyBored, Άρης
Δάσος, Ron Lauzon, TheFred, Paul Theodoropolous, Doug Phillips, Les
Vogel, Matt Pollard, Andres Cordova
Print first last [name] (as shown above) but ordered by last first.
In cases like this where data with Latin and Greek characters are
mixed you should clarify or even define how the comparison function
shall operate on mixed data to create a "correct" ordering.
Hereabouts we usually insert the "Άρης Δάσος" (starting with the letter Delta) before or after the letter 'D'; i.e. using an implicit transcription. But this may not suit other cases. Or artificial ones
like this challenge, so you should probably clarify for folks who
are interested to re-implement (or use) a sorting function in "C"
(with or without a locale setting to do the dirty work).
------------------------------------------------------------------No necessity for peeking since I'd write a Unix 'sort' one-liner
No peeking!
[...removed without peeking...]
71 SLOC
(instead of a bulky "C" program). ;-)
Honestly; mind to explain what the point of this "C" challenge is?
(From the application user's perspective the most interesting thing
would be a sophisticated handling of "mixed locales", but I assume
you're just using what C's 'str*cmp' functions technically provide
with whatever environment setting, and the challenge is something
else?)
Janis
Keith Thompson <[email protected]> writes:
Tim Rentsch <[email protected]> writes:
[...]
The semantics of !ptr has been codified to mean 1 for null pointers
since the original C standard. Heck, even during the 1970s when C
allowed assigning integers directly to pointers, K&R said that
assigning 0 to a pointer produces a pointer guaranteed to be
different than a pointer to any object. Any C implementation where
!ptr does the wrong thing should be avoided like the plague.
Any C implementation where !ptr does the wrong thing almost certainly
does not exist. It's difficult to imagine that a C compiler with
such a fundamental bug would ever go out the door.
My usual preference is to draw conclusions based on evidence rather imagination or supposition.
It's barely possible that compiler that uses a representation other
than all-bits-zero for null pointers might have such a bug, but
(a) anyone creating such an implementation will almost certainly
be extremely careful to get such things right, and (b) I'm not sure
that any such compilers even exist, except perhaps for old systems
that would be considered exotic today.
Here again this sounds like just supposition. How much experience
do you have, and how extensive, using non-mainstream C compilers?
For myself I can't say I much at all, but I have seen one where
believe it or not assert() was implemented wrongly. assert()! I
certainly wouldn't have guessed that before actually seeing it.
Tim Rentsch <[email protected]> writes:
[email protected] (Scott Lurndal) writes:
Or even obsolete. The systems in question were all retired by
2010, and never had a C compiler. The system was BCD and the
six digit 'undigit' value of EEEEEE was chosen as the NIL (NULL)
pointer value.
It would be nice if in the future it were stated directly when a
non-C environment is the context of a comment. I mistakenly
understood that what you were saying had to do with experience
using some unusual C compiler.
I was in the OS group at the time. The languages group had
started looking at writing a C compiler for the architecture, but
it never panned out (and there was little interest from the
predominantly COBOL customer base).
BTW, I think that (ptr != 0) is guaranteed to work even on systems with
null pointers not being numerically zero. ...
As usual - in a superior language.
#include <iostream>
#include <utility>
#include <string_view>
#include <regex>
#include <vector>
#include <algorithm>
using namespace std;
static constexpr string_view Names = "Martin Hohenberg, Jae Yang, Tim
Bando, Daniel Garber, Kyle Burkholder, Mike Nichols, Mark Ping, Tom
Taylor, Arnold F. Williams, George Brower, Michael Nygard, Brendan Long, Sven Dowideit, Dave Witten, Jonathan Cast, James Cronin, David L.
Jessup, Christopher Chang, Killer Delicious, Jacob Lyles, Neil
Anuskiewicz, Mordant, Clemens Ladisch, Wojciech Woytniak, Masa Bando,
John Carmack, Xingyu Wang, Jane Tang, Steven Evans, Jan Roudaut, Hsueh
Sung, Ken LaCrosse, taishi28012, John Simpson, Jerod Tufte, Paul Abbott, Stan Witherspoon, Donald Greer, Gratiela Chergu, Michael Ciagala, Dale Carstensen, Chip Davis, Liudmilla Karukina, Jim McCloskey, Dewey Sasser,
Hal Hildebrand, Connor Wood, Ken Kennedy, darrin, Mark Gardner, William Christensen, Malcolm Ocean, Rod Davenport, Nodarius Darjania, Cheryl
Evry, Wenfeng Liang, Irving Rivas, Bill Soistman, ReallyBored, Άρης Δάσος, Ron Lauzon, TheFred, Paul Theodoropolous, Doug Phillips, Les Vogel, Matt Pollard, Andres Cordova";
int main()
{
regex
rxComma( "\\s*([^,]+)(,|$)" ),
rxRvSurname( "\\s*(\\S+)" ),
rxGapSpaces( "(\\s+)" );
match_results<string_view::iterator> mtch;
match_results<string_view::reverse_iterator> reverseMatch;
using name = pair<string_view, string_view>;
vector<name> names;
for( auto itName = ::Names.begin(); ; itName = mtch[0].second )
{
if( !regex_search( itName, ::Names.end(), mtch, rxComma ) )
break;
if( !regex_search( reverse_iterator( mtch[1].second ), reverse_iterator( mtch[1].first ), reverseMatch, rxRvSurname ) )
continue;
auto
itSurname = reverseMatch[1].second.base(),
itSurnameEnd = reverseMatch[1].first.base();
string_view surname( itSurname, itSurnameEnd );
auto itForename = mtch[1].first;
if( !regex_search( reverse_iterator( itSurname ), reverse_iterator( itForename ), reverseMatch, rxGapSpaces ) )
continue;
auto itForenameEnd = reverseMatch[1].second.base();
string_view forename( itForename, itForenameEnd );
names.emplace_back( forename, surname );
}
sort( names.begin(), names.end(), []( const name &lhs, const name &rhs ) { return lhs.second < rhs.second; } );
for( const name &nm : names )
{
cout << "\"" << nm.first << "\" - \"" << nm.second << "\"" <<
endl;
}
}
The cool thing about that that I'm matching a part of the name with
a reverse-iterator, i.e. I do reverse regex parsing (the regex itself
is forward).
What's not cool is that it takes 4.7 seconds to compile this 45 line program, unoptimised. and 7.7 seconds optimised.
Does it need to be optimised? I guess so, even if it's just to get the
size down: optimised is 136KB, unoptimised it's 319KB.
Tiny C builds the C version in pretty much zero seconds, for a 8KB program.
Am 09.04.2026 um 01:59 schrieb Michael S:
BTW, I think that (ptr != 0) is guaranteed to work even on systems with
null pointers not being numerically zero. ...
Sorry, that's ridiculous. Which system ever has used sth. different than
a physical null-pointer for a logical. And do you really expect that to >happen in the future ?
You see uncertainties where ther are non.
In article <10rr402$1r3mi$[email protected]>,
Bonita Montero <[email protected]> wrote:
Sorry, that's ridiculous. Which system ever has used sth. different than
a physical null-pointer for a logical. And do you really expect that to
happen in the future ?
You see uncertainties where ther are non.
Hmm, I wonder if the AS/400 has this.
Honestly; mind to explain what the point of this "C" challenge is?
Martin Hohenberg, Jae Yang, Tim Bando, Daniel Garber, Kyle Burkholder,
Mike Nichols, Mark Ping, Tom Taylor, Arnold F. Williams, George Brower, >Michael Nygard, Brendan Long, Sven Dowideit, Dave Witten, Jonathan Cast, >James Cronin, David L. Jessup, Christopher Chang, Killer Delicious,
Jacob Lyles, Neil Anuskiewicz, Mordant, Clemens Ladisch, Wojciech
Woytniak, Masa Bando, John Carmack, Xingyu Wang, Jane Tang, Steven
Evans, Jan Roudaut, Hsueh Sung, Ken LaCrosse, taishi28012, John Simpson, >Jerod Tufte, Paul Abbott, Stan Witherspoon, Donald Greer, Gratiela
Chergu, Michael Ciagala, Dale Carstensen, Chip Davis, Liudmilla
Karukina, Jim McCloskey, Dewey Sasser, Hal Hildebrand, Connor Wood, Ken >Kennedy, darrin, Mark Gardner, William Christensen, Malcolm Ocean, Rod >Davenport, Nodarius Darjania, Cheryl Evry, Wenfeng Liang, Irving Rivas,
Bill Soistman, ReallyBored, ???? ?????, Ron Lauzon, TheFred, Paul >Theodoropolous, Doug Phillips, Les Vogel, Matt Pollard, Andres Cordova
Print first last (as shown above) but ordered by last first.ot
Martin Hohenberg, Jae Yang, Tim Bando, Daniel Garber, Kyle Burkholder,
Mike Nichols, Mark Ping, Tom Taylor, Arnold F. Williams, George Brower, Michael Nygard, Brendan Long, Sven Dowideit, Dave Witten, Jonathan Cast, James Cronin, David L. Jessup, Christopher Chang, Killer Delicious,
Jacob Lyles, Neil Anuskiewicz, Mordant, Clemens Ladisch, Wojciech
Woytniak, Masa Bando, John Carmack, Xingyu Wang, Jane Tang, Steven
Evans, Jan Roudaut, Hsueh Sung, Ken LaCrosse, taishi28012, John Simpson, Jerod Tufte, Paul Abbott, Stan Witherspoon, Donald Greer, Gratiela
Chergu, Michael Ciagala, Dale Carstensen, Chip Davis, Liudmilla
Karukina, Jim McCloskey, Dewey Sasser, Hal Hildebrand, Connor Wood, Ken Kennedy, darrin, Mark Gardner, William Christensen, Malcolm Ocean, Rod Davenport, Nodarius Darjania, Cheryl Evry, Wenfeng Liang, Irving Rivas,
Bill Soistman, ReallyBored, Άρης Δάσος, Ron Lauzon, TheFred, Paul Theodoropolous, Doug Phillips, Les Vogel, Matt Pollard, Andres Cordova
Print first last (as shown above) but ordered by last first.
------------------------------------------------------------------
No peeking! ------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char names[2000] = {"Martin Hohenberg, Jae Yang, Tim Bando, Daniel
Garber, Kyle Burkholder, Mike Nichols, Mark Ping, Tom Taylor, Arnold F. Williams, George Brower, Michael Nygard, Brendan Long, Sven Dowideit,
Dave Witten, Jonathan Cast, James Cronin, David L. Jessup, Christopher
Chang, Killer Delicious, Jacob Lyles, Neil Anuskiewicz, Mordant, Clemens Ladisch, Wojciech Woytniak, Masa Bando, John Carmack, Xingyu Wang, Jane
Tang, Steven Evans, Jan Roudaut, Hsueh Sung, Ken LaCrosse, taishi28012,
John Simpson, Jerod Tufte, Paul Abbott, Stan Witherspoon, Donald Greer, Gratiela Chergu, Michael Ciagala, Dale Carstensen, Chip Davis, Liudmilla Karukina, Jim McCloskey, Dewey Sasser, Hal Hildebrand, Connor Wood, Ken Kennedy, darrin, Mark Gardner, William Christensen, Malcolm Ocean, Rod Davenport, Nodarius Darjania, Cheryl Evry, Wenfeng Liang, Irving Rivas,
Bill Soistman, ReallyBored, Άρης Δάσος, Ron Lauzon, TheFred, Paul Theodoropolous, Doug Phillips, Les Vogel, Matt Pollard, Andres
Cordova"};
//count characters in a string int countchr(char *str, char chr)
{int c=0,cnt=0;while(str[c]!='\0'){if(str[c]==chr){cnt++;}c++;}return
cnt;}
//compare for qsort int comparechar( const void *a, const void *b)
{
const char **chara = (const char **)a;
const char **charb = (const char **)b;
return strcasecmp(*chara, *charb);
//return strcmp(*chara, *charb);
}
//left trim spaces void ltrim(char *str)
{
int totrim = strspn(str," ");
if (totrim > 0)
{
int len = strlen(str);
if (totrim == len)
{ str[0] = '\0'; } else
{memmove(str, str + totrim, len + 1 - totrim);}
}
}
int main(void)+ 1;
{
//vars
char delim[2] = ",";
int i=0,j=0;
//number of names is commas + 1 int namecnt = countchr(names,',')
*lname; //
//name array: one column for first-last, one for last-first char
*narr[2][namecnt];
char *flname, lfname[30]; // full names char *fname,
part names char tmp[30]="";full
// parse full names from string // then parse first and last from
name // add both into array char *dup = strdup(names);strlen(lname)-1);
while((flname = strsep(&dup,delim)) != NULL )
{
ltrim(flname);
if(countchr(flname,' ')>0)
{
lname = strrchr(flname,' ')+1;
memset(tmp, '\0', sizeof(tmp));
strncat(tmp,flname,strlen(flname)-
fname = strdup(tmp);strdup(flname);
}
else {
lname = strdup(flname);
fname = strdup("");
fname[strlen(fname)-2] = '\0';
}
sprintf(lfname,"%s %s",lname,fname); narr[0][i]=
narr[1][i]= strdup(lfname);
i++;
}
//add list of last-first names into array then sort it char
*sarr[namecnt];
for(i=0;i<namecnt;i++) {sarr[i] = narr[1][i];}
qsort(sarr, namecnt, sizeof(char*), comparechar);
//print first-last in order by last-first for(i=0;i<namecnt;i++)
{
for(j=0;j<namecnt;j++)
{
if(narr[1][j] == sarr[i])
{
printf("%d %s\n",i+1, narr[0][j]);
break;
}
}
}
return 0;
}
------------------------------------------------------------------
71 SLOC
sort( names.begin(), names.end(), []( const name &lhs, const name &rhs ) { return lhs.second < rhs.second; } );
On Tue, 7 Apr 2026 23:14:41 -0400, DFS wrote:
Martin Hohenberg, Jae Yang, Tim Bando, Daniel Garber, Kyle Burkholder,ot
Mike Nichols, Mark Ping, Tom Taylor, Arnold F. Williams, George Brower,
Michael Nygard, Brendan Long, Sven Dowideit, Dave Witten, Jonathan Cast,
James Cronin, David L. Jessup, Christopher Chang, Killer Delicious,
Jacob Lyles, Neil Anuskiewicz, Mordant, Clemens Ladisch, Wojciech
Woytniak, Masa Bando, John Carmack, Xingyu Wang, Jane Tang, Steven
Evans, Jan Roudaut, Hsueh Sung, Ken LaCrosse, taishi28012, John Simpson,
Jerod Tufte, Paul Abbott, Stan Witherspoon, Donald Greer, Gratiela
Chergu, Michael Ciagala, Dale Carstensen, Chip Davis, Liudmilla
Karukina, Jim McCloskey, Dewey Sasser, Hal Hildebrand, Connor Wood, Ken
Kennedy, darrin, Mark Gardner, William Christensen, Malcolm Ocean, Rod
Davenport, Nodarius Darjania, Cheryl Evry, Wenfeng Liang, Irving Rivas,
Bill Soistman, ReallyBored, ???? ?????, Ron Lauzon, TheFred, Paul
Theodoropolous, Doug Phillips, Les Vogel, Matt Pollard, Andres Cordova
Print first last (as shown above) but ordered by last first.
this would be one APL program in "brace" form and its result, because
here it seems is difficult print 2 chars chars
s{leftarrow}{apostrophe}Martin Hohenberg, Jae Yang, Tim Bando,
Daniel Garber, Kyle Burkholder, Mike Nichols, Mark Ping, Tom Taylor,
Arnold F. Williams, George Brower, Michael Nygard, Brendan Long, Sven Dowideit, Dave Witten, Jonathan Cast, James Cronin, David L. Jessup, Christopher Chang, Killer Delicious, Jacob Lyles, Neil Anuskiewicz,
Mordant, Clemens Ladisch, Wojciech Woytniak, Masa Bando, John Carmack,
Xingyu Wang, Jane Tang, Steven Evans, Jan Roudaut, Hsueh Sung, Ken
LaCrosse, taishi28012, John Simpson, Jerod Tufte, Paul Abbott, Stan Witherspoon, Donald Greer, Gratiela Chergu, Michael Ciagala, Dale
Carstensen, Chip Davis, Liudmilla Karukina, Jim McCloskey, Dewey
Sasser, Hal Hildebrand, Connor Wood, Ken Kennedy, darrin, Mark
Gardner, William Christensen, Malcolm Ocean, Rod Davenport, Nodarius Darjania, Cheryl Evry, Wenfeng Liang, Irving Rivas, Bill Soistman, ReallyBored, {\x00CE}{\x2020}{\x00CF}{\x0081}{\x00CE}{\x00B7} {\x00CF}{\x201A}
{\x00CE}{\x201D}{\x00CE}{\x00AC}{\x00CF}{\x0192}{\x00CE} {\x00BF}{\x00CF}{\x201A}, Ron Lauzon, TheFred, Paul Theodoropolous,
Doug Phillips, Les Vogel, Matt Pollard, Andres
Cordova{apostrophe}{cr}{lf}
{commabar}{leftbrace}k[{deltastile}{rightshoe}{uparrow}{dieresis}{leftbrace}1{downarrow}{omega}{rightbrace}{dieresis}k{leftarrow}{leftbrace}({omega}{notequal}{apostrophe}
{apostrophe}){leftshoe}{omega}{rightbrace}{dieresis}({omega}{notequal}{apostrophe},{apostrophe}){leftshoe}{omega}]{rightbrace}s{cr}{lf}
Mordant
taishi28012
darrin
ReallyBored
TheFred
Paul Abbott
Neil Anuskiewicz
Tim Bando--------------------------------
Masa Bando
George Brower
Kyle Burkholder
John Carmack
Dale Carstensen
Jonathan Cast
Christopher Chang
Gratiela Chergu
William Christensen
Michael Ciagala
Andres Cordova
James Cronin
Nodarius Darjania
Rod Davenport
Chip Davis
Killer Delicious
Sven Dowideit
Steven Evans
Cheryl Evry
Arnold F. Williams
Daniel Garber
Mark Gardner
Donald Greer
Hal Hildebrand
Martin Hohenberg
Liudmilla Karukina
Ken Kennedy
David L. Jessup
Ken LaCrosse
Clemens Ladisch
Ron Lauzon
Wenfeng Liang
Brendan Long
Jacob Lyles
Jim McCloskey
Mike Nichols
Michael Nygard
Malcolm Ocean
Doug Phillips
Mark Ping
Matt Pollard
Irving Rivas
Jan Roudaut
Dewey Sasser
John Simpson
Bill Soistman
Hsueh Sung
Jane Tang
Tom Taylor
Paul Theodoropolous
Jerod Tufte
Les Vogel
Xingyu Wang
Stan Witherspoon
Dave Witten
Connor Wood
Wojciech Woytniak
Jae Yang
On 4/18/2026 5:16 AM, Rosario19 wrote:
On Tue, 7 Apr 2026 23:14:41 -0400, DFS wrote:
Martin Hohenberg, Jae Yang, Tim Bando, Daniel Garber, Kyle Burkholder,ot
Mike Nichols, Mark Ping, Tom Taylor, Arnold F. Williams, George Brower,
Michael Nygard, Brendan Long, Sven Dowideit, Dave Witten, Jonathan Cast, >>> James Cronin, David L. Jessup, Christopher Chang, Killer Delicious,
Jacob Lyles, Neil Anuskiewicz, Mordant, Clemens Ladisch, Wojciech
Woytniak, Masa Bando, John Carmack, Xingyu Wang, Jane Tang, Steven
Evans, Jan Roudaut, Hsueh Sung, Ken LaCrosse, taishi28012, John Simpson, >>> Jerod Tufte, Paul Abbott, Stan Witherspoon, Donald Greer, Gratiela
Chergu, Michael Ciagala, Dale Carstensen, Chip Davis, Liudmilla
Karukina, Jim McCloskey, Dewey Sasser, Hal Hildebrand, Connor Wood, Ken
Kennedy, darrin, Mark Gardner, William Christensen, Malcolm Ocean, Rod
Davenport, Nodarius Darjania, Cheryl Evry, Wenfeng Liang, Irving Rivas,
Bill Soistman, ReallyBored, ???? ?????, Ron Lauzon, TheFred, Paul
Theodoropolous, Doug Phillips, Les Vogel, Matt Pollard, Andres Cordova
Print first last (as shown above) but ordered by last first.
this would be one APL program in "brace" form and its result, because
here it seems is difficult print 2 chars chars
s{leftarrow}{apostrophe}Martin Hohenberg, Jae Yang, Tim Bando, >> Daniel Garber, Kyle Burkholder, Mike Nichols, Mark Ping, Tom Taylor,
Arnold F. Williams, George Brower, Michael Nygard, Brendan Long, Sven
Dowideit, Dave Witten, Jonathan Cast, James Cronin, David L. Jessup,
Christopher Chang, Killer Delicious, Jacob Lyles, Neil Anuskiewicz,
Mordant, Clemens Ladisch, Wojciech Woytniak, Masa Bando, John Carmack,
Xingyu Wang, Jane Tang, Steven Evans, Jan Roudaut, Hsueh Sung, Ken
LaCrosse, taishi28012, John Simpson, Jerod Tufte, Paul Abbott, Stan
Witherspoon, Donald Greer, Gratiela Chergu, Michael Ciagala, Dale
Carstensen, Chip Davis, Liudmilla Karukina, Jim McCloskey, Dewey
Sasser, Hal Hildebrand, Connor Wood, Ken Kennedy, darrin, Mark
Gardner, William Christensen, Malcolm Ocean, Rod Davenport, Nodarius
Darjania, Cheryl Evry, Wenfeng Liang, Irving Rivas, Bill Soistman,
ReallyBored, {\x00CE}{\x2020}{\x00CF}{\x0081}{\x00CE}{\x00B7}
{\x00CF}{\x201A}
{\x00CE}{\x201D}{\x00CE}{\x00AC}{\x00CF}{\x0192}{\x00CE}
{\x00BF}{\x00CF}{\x201A}, Ron Lauzon, TheFred, Paul Theodoropolous,
Doug Phillips, Les Vogel, Matt Pollard, Andres
Cordova{apostrophe}{cr}{lf}
{commabar}{leftbrace}k[{deltastile}{rightshoe}{uparrow}{dieresis}
{leftbrace}1{downarrow}{omega}{rightbrace}{dieresis}k{leftarrow}
{leftbrace}({omega}{notequal}{apostrophe}
{apostrophe}){leftshoe}{omega}{rightbrace}{dieresis}({omega}{notequal}
{apostrophe},{apostrophe}){leftshoe}{omega}]{rightbrace}s{cr}{lf}
Mordant
taishi28012
darrin
ReallyBored
TheFred
Paul Abbott
Neil Anuskiewicz
--------------------------------
Tim Bando--------------------------------
Masa Bando
FAIL
I think this needs to be a case-insensitive sort.
While the OP's data only had capitalised surnames (with one exception), their solution used a string-sensitive compare.
The exception is the name "taishi28012". With your code, that name
doesn't appear at all in the output.
If I add a dummy first name to this, then it appears last of all the
ASCII names, but before the Greek name.
$ cat names.txt | tr -d '\n' | sed 's/,/\n/g' | sed 's/^ //g' | awk 'NF ==Uh-oh! - Why so complicated?
3 { print $1, $3, $2 } NF == 2 { print $1, $2 } NF ==1 { print $1 }' |
sort -k 2,2 -k 1,1 | awk 'NF == 3 { print $1, $3, $2 } NF == 2 { print
$1, $2 } NF ==1 { print $1 }'
One terser way (including considering single word entities as the
name to get sorted in like a surname) can be
sed 's/, /\n/g' names.txt | awk '{print $NF"\t"$0}' |
sort |
sed 's/.*\t//'
In article <10s20jf$2b5i9$[email protected]>,
Janis Papanagnou <[email protected]> wrote:
...
One terser way (including considering single word entities as the
name to get sorted in like a surname) can be
sed 's/, /\n/g' names.txt | awk '{print $NF"\t"$0}' |
sort |
sed 's/.*\t//'
First, on the code of "code golfing" this: Surely, any construct of the
form: sed ... | awk ...
can be simplified into a single call to awk, since (with exceptions so few
as to be irrelevant) anything sed can do, awk can do.
And, of course, whatever the above command line is doing (I haven't
followed this thread closely enough to know what it is actually about), can >be done in a single invocation of GAWK (or TAWK), which has built-in
sorting. It could also be done in a single invocation of any AWK (or Perl
or whatever) if you are willing to write your own sort routine.
And, of course, other posters should be along any minute with Perl (or Ruby >or Python or ...) one-liners as well.
Second, I would imagine that whoever constructed the original line (to
which you responded) probably developed it from scratch by stringing things >together and is quite proud of the effort, so he saw no need to trim it
down for posting. Hence the appearance as it is.
{commabar}{leftbrace}k[{deltastile}{rightshoe}{uparrow}{dieresis}{leftbrace}1{downarrow}{omega}{rightbrace}{dieresis}k{leftarrow}{leftbrace}({omega}{notequal}{apostrophe}
{apostrophe}){leftshoe}{omega}{rightbrace}{dieresis}({omega}{notequal}{apostrophe},{apostrophe}){leftshoe}{omega}]{rightbrace}s{cr}{lf}
Mordant
taishi28012
darrin
ReallyBored
TheFred
Paul Abbott
Neil Anuskiewicz
Tim Bando
Masa Bando
George Brower
Kyle Burkholder
John Carmack
Dale Carstensen
Jonathan Cast
Christopher Chang
Gratiela Chergu
William Christensen
Michael Ciagala
Andres Cordova
James Cronin
Nodarius Darjania
Rod Davenport
Chip Davis
Killer Delicious
Sven Dowideit
Steven Evans
Cheryl Evry
Arnold F. Williams
Daniel Garber
Mark Gardner
Donald Greer
Hal Hildebrand
Martin Hohenberg
Liudmilla Karukina
Ken Kennedy
David L. Jessup
Ken LaCrosse
Clemens Ladisch
Ron Lauzon
Wenfeng Liang
Brendan Long
Jacob Lyles
Jim McCloskey
Mike Nichols
Michael Nygard
Malcolm Ocean
Doug Phillips
Mark Ping
Matt Pollard
Irving Rivas
Jan Roudaut
Dewey Sasser
John Simpson
Bill Soistman
Hsueh Sung
Jane Tang
Tom Taylor
Paul Theodoropolous
Jerod Tufte
Les Vogel
Xingyu Wang
Stan Witherspoon
Dave Witten
Connor Wood
Wojciech Woytniak
Jae Yang
this is a C version
---------------------------------
result:
---------------------------------
TheFred
taishi28012
darrin
ReallyBored
Mordant
Paul Abbott
Neil Anuskiewicz
Tim Bando------------------
Masa Bando
George Brower
Kyle Burkholder
John Carmack
Dale Carstensen
Jonathan Cast
Christopher Chang
Gratiela Chergu
William Christensen
Michael Ciagala
Andres Cordova
James Cronin
Nodarius Darjania
Rod Davenport
Chip Davis
Killer Delicious
Sven Dowideit
Steven Evans
Cheryl Evry
Arnold F. Williams------------------------
Daniel Garber
Mark Gardner
Donald Greer
Hal Hildebrand
Martin Hohenberg
Liudmilla Karukina
Ken Kennedy
David L. Jessup
Ken LaCrosse
Clemens Ladisch
Ron Lauzon
Wenfeng Liang
Brendan Long
Jacob Lyles
Jim McCloskey
Mike Nichols
Michael Nygard
Malcolm Ocean
Doug Phillips
Mark Ping
Matt Pollard
Irving Rivas
Jan Roudaut
Dewey Sasser
John Simpson
Bill Soistman
Hsueh Sung
Jane Tang
Tom Taylor
Paul Theodoropolous
Jerod Tufte
Les Vogel
Xingyu Wang
Stan Witherspoon
Dave Witten
Connor Wood
Wojciech Woytniak
Jae Yang
this is a C version
#define R return
#define P printf
{commabar}{leftbrace}k[{deltastile}{rightshoe}{uparrow}{dieresis}{leftbrace}1{downarrow}{omega}{rightbrace}{dieresis}k{leftarrow}{leftbrace}({omega}{notequal}{apostrophe}
{apostrophe}){leftshoe}{omega}{rightbrace}{dieresis}({omega}{notequal}{apostrophe},{apostrophe}){leftshoe}{omega}]{rightbrace}s{cr}{lf}
for me in APL the process of programming is show in the screen each
change of input using the next function (or imagine that)
in C the same.
On 4/20/2026 3:20 PM, Rosario19 wrote:
this is a C version
<snip>
---------------------------------
result:
---------------------------------
TheFred
taishi28012
darrin
ReallyBored
Mordant
Paul Abbott
Neil Anuskiewicz
------------------
Tim Bando------------------
Masa Bando
fail
George Brower
Kyle Burkholder
John Carmack
Dale Carstensen
Jonathan Cast
Christopher Chang
Gratiela Chergu
William Christensen
Michael Ciagala
Andres Cordova
James Cronin
Nodarius Darjania
Rod Davenport
Chip Davis
Killer Delicious
Sven Dowideit
Steven Evans
Cheryl Evry
------------------------
Arnold F. Williams------------------------
fail
Daniel Garber
Mark Gardner
Donald Greer
Hal Hildebrand
Martin Hohenberg
Liudmilla Karukina
Ken Kennedy
David L. Jessup
Ken LaCrosse
Clemens Ladisch
Ron Lauzon
Wenfeng Liang
Brendan Long
Jacob Lyles
Jim McCloskey
Mike Nichols
Michael Nygard
Malcolm Ocean
Doug Phillips
Mark Ping
Matt Pollard
Irving Rivas
Jan Roudaut
Dewey Sasser
John Simpson
Bill Soistman
Hsueh Sung
Jane Tang
Tom Taylor
Paul Theodoropolous
Jerod Tufte
Les Vogel
Xingyu Wang
Stan Witherspoon
Dave Witten
Connor Wood
Wojciech Woytniak
Jae Yang
On Mon, 20 Apr 2026 16:43:28 -0400, DFS wrote:
On 4/20/2026 3:20 PM, Rosario19 wrote:
this is a C version
<snip>
---------------------------------
result:
---------------------------------
TheFred
taishi28012
darrin
ReallyBored
Mordant
Paul Abbott
Neil Anuskiewicz
------------------
Tim Bando------------------
Masa Bando
fail
the spec.. not speak about order by first name but only for the second
name. So that is all UB
George Brower
Kyle Burkholder
John Carmack
Dale Carstensen
Jonathan Cast
Christopher Chang
Gratiela Chergu
William Christensen
Michael Ciagala
Andres Cordova
James Cronin
Nodarius Darjania
Rod Davenport
Chip Davis
Killer Delicious
Sven Dowideit
Steven Evans
Cheryl Evry
------------------------
Arnold F. Williams------------------------
fail
the spec.. not speak about if the second names is just F. so F is a
valid second name.
Rosario19 <[email protected]d> writes:
[...]
this is a C version[...]
#define R return
#define P printf
Nope.
[...]
On 4/20/2026 11:09 PM, Rosario19 wrote:
On Mon, 20 Apr 2026 16:43:28 -0400, DFS wrote:
On 4/20/2026 3:20 PM, Rosario19 wrote:
this is a C version
<snip>
---------------------------------
result:
---------------------------------
TheFred
taishi28012
darrin
ReallyBored
Mordant
Paul Abbott
Neil Anuskiewicz
------------------
Tim Bando------------------
Masa Bando
fail
the spec.. not speak about order by first name but only for the second
name. So that is all UB
The 'spec' was clear: order by last, first.
On 21/04/2026 13:46, DFS wrote:
On 4/20/2026 11:09 PM, Rosario19 wrote:
On Mon, 20 Apr 2026 16:43:28 -0400, DFS wrote:
On 4/20/2026 3:20 PM, Rosario19 wrote:
this is a C version
<snip>
---------------------------------
result:
---------------------------------
TheFred
taishi28012
darrin
ReallyBored
Mordant
Paul Abbott
Neil Anuskiewicz
------------------
Tim Bando------------------
Masa Bando
fail
the spec.. not speak about order by first name but only for the second
name. So that is all UB
The 'spec' was clear: order by last, first.
The spec didn't mention case-sensitive compare.
It didn't mention what happens when there is one name.
It didn't mention what happens when there are three or more names, or
middle initials.
It didn't say anything about how much white space, or how much less,could be anticipated. So any new input that varies from your example
might not work.
It didn't give any examples of what the output needs to look, at least
not in your OP. (They can see it by running your submission, but it says
no peeking.)
On 4/21/2026 11:08 AM, Bart wrote:
On 21/04/2026 13:46, DFS wrote:
On 4/20/2026 11:09 PM, Rosario19 wrote:
On Mon, 20 Apr 2026 16:43:28 -0400, DFS wrote:
On 4/20/2026 3:20 PM, Rosario19 wrote:
this is a C version
<snip>
---------------------------------
result:
---------------------------------
TheFred
taishi28012
darrin
ReallyBored
Mordant
Paul Abbott
Neil Anuskiewicz
------------------
Tim Bando------------------
Masa Bando
fail
the spec.. not speak about order by first name but only for the second >>>> name. So that is all UB
The 'spec' was clear: order by last, first.
The spec didn't mention case-sensitive compare.
It didn't mention what happens when there is one name.
It didn't mention what happens when there are three or more names, or
middle initials.
It didn't say anything about how much white space, or how much less,could be anticipated. So any new input that varies from your example
might not work.
It didn't give any examples of what the output needs to look, at least
not in your OP. (They can see it by running your submission, but it
says no peeking.)
You don't really need all that handholding do you?
None of those issues would be typical of what the PHB would ask you to
do. "Sort this list by last name then first name" is all I would expect
to get. Asking about case-sensitivity and 4 names and whitespace would make you look like a ninny.
On 21/04/2026 16:33, DFS wrote:
On 4/21/2026 11:08 AM, Bart wrote:
It didn't give any examples of what the output needs to look, at least
not in your OP. (They can see it by running your submission, but it
says no peeking.)
You don't really need all that handholding do you?
None of those issues would be typical of what the PHB would ask you to
do. "Sort this list by last name then first name" is all I would expect >> to get. Asking about case-sensitivity and 4 names and whitespace would
make you look like a ninny.
Bart <[email protected]> writes:
On 21/04/2026 16:33, DFS wrote:
On 4/21/2026 11:08 AM, Bart wrote:
It didn't give any examples of what the output needs to look, at
least not in your OP. (They can see it by running your
submission, but it says no peeking.)
You don't really need all that handholding do you?
None of those issues would be typical of what the PHB would ask
you to do. "Sort this list by last name then first name" is all
I would expect to get. Asking about case-sensitivity and 4 names
and whitespace would make you look like a ninny.
You seem to be confusing a comic strip with reality.
In the real world, for professional developers, detailed
specifications are common. Forty years ago, detailed
specifications were common (we had three levels of
specification for each project back in 1983; a concept
spec, a detailed specification and a test specification).
Even the two startups I've been associated with had clear
and concise specifications for each project.
On Tue, 21 Apr 2026 17:38:03 GMT
[email protected] (Scott Lurndal) wrote:
Bart <[email protected]> writes:
On 21/04/2026 16:33, DFS wrote: =20=20
On 4/21/2026 11:08 AM, Bart wrote: =20
=20=20
It didn't give any examples of what the output needs to look, at
least not in your OP. (They can see it by running your
submission, but it says no peeking.) =20
=20
You don't really need all that handholding do you?
=20
None of those issues would be typical of what the PHB would ask
you to do.=C2=A0 "Sort this list by last name then first name" is all
I would expect to get.=C2=A0 Asking about case-sensitivity and 4 names
and whitespace would make you look like a ninny. =20
You seem to be confusing a comic strip with reality.
=20
In the real world, for professional developers, detailed
specifications are common. Forty years ago, detailed
specifications were common (we had three levels of
specification for each project back in 1983; a concept
spec, a detailed specification and a test specification).
=20
Even the two startups I've been associated with had clear
and concise specifications for each project.
=20
Methinks, the segment of the industry that employed you for last nn
(40?) years is an exception rather than rule.
In article <10s653e$11uo1$[email protected]>,
Keith Thompson <[email protected]> wrote:
Rosario19 <[email protected]d> writes:
[...]
this is a C version[...]
#define R return
#define P printf
Nope.
[...]
I think they put stuff like that in their postings just to piss you off.
They know how easy it is to light you up.
On 21/04/2026 16:33, DFS wrote:
On 4/21/2026 11:08 AM, Bart wrote:
On 21/04/2026 13:46, DFS wrote:
On 4/20/2026 11:09 PM, Rosario19 wrote:
On Mon, 20 Apr 2026 16:43:28 -0400, DFS wrote:
On 4/20/2026 3:20 PM, Rosario19 wrote:
this is a C version
<snip>
---------------------------------
result:
---------------------------------
TheFred
taishi28012
darrin
ReallyBored
Mordant
Paul Abbott
Neil Anuskiewicz
------------------
Tim Bando------------------
Masa Bando
fail
the spec.. not speak about order by first name but only for the second >>>>> name. So that is all UB
The 'spec' was clear: order by last, first.
The spec didn't mention case-sensitive compare.
It didn't mention what happens when there is one name.
It didn't mention what happens when there are three or more names, or
middle initials.
It didn't say anything about how much white space, or how much less, >>> could be anticipated. So any new input that varies from your examplemight not work.
It didn't give any examples of what the output needs to look, at
least not in your OP. (They can see it by running your submission,
but it says no peeking.)
You don't really need all that handholding do you?
None of those issues would be typical of what the PHB would ask you to
do. "Sort this list by last name then first name" is all I would
expect to get. Asking about case-sensitivity and 4 names and
whitespace would make you look like a ninny.
So you don't care? Then your specification is sloppy.
On 4/21/2026 1:25 PM, Bart wrote:
On 21/04/2026 16:33, DFS wrote:
On 4/21/2026 11:08 AM, Bart wrote:
On 21/04/2026 13:46, DFS wrote:less,
On 4/20/2026 11:09 PM, Rosario19 wrote:
On Mon, 20 Apr 2026 16:43:28 -0400, DFS wrote:
On 4/20/2026 3:20 PM, Rosario19 wrote:
this is a C version
<snip>
---------------------------------
result:
---------------------------------
TheFred
taishi28012
darrin
ReallyBored
Mordant
Paul Abbott
Neil Anuskiewicz
------------------
Tim Bando------------------
Masa Bando
fail
the spec.. not speak about order by first name but only for the
second
name. So that is all UB
The 'spec' was clear: order by last, first.
The spec didn't mention case-sensitive compare.
It didn't mention what happens when there is one name.
It didn't mention what happens when there are three or more names, or
middle initials.
It didn't say anything about how much white space, or how much
could be anticipated. So any new input that varies from your example
might not work.
It didn't give any examples of what the output needs to look, at
least not in your OP. (They can see it by running your submission,
but it says no peeking.)
You don't really need all that handholding do you?
None of those issues would be typical of what the PHB would ask you
to do. "Sort this list by last name then first name" is all I would
expect to get. Asking about case-sensitivity and 4 names and
whitespace would make you look like a ninny.
So you don't care? Then your specification is sloppy.
You misspelled realistic.
In article <10s2o7p$25ao7$[email protected]>,
Kenny McCormack <[email protected]> wrote:
In article <10s20jf$2b5i9$[email protected]>,
Janis Papanagnou <[email protected]> wrote:
...
sed 's/, /\n/g' names.txt | awk '{print $NF"\t"$0}' |
sort |
sed 's/.*\t//'
First, on the code of "code golfing" this: Surely, any construct of the
form: sed ... | awk ...
Probably. But I'm not sure that's all that useful in the
general case. The `sed` command here is translating logical
records into lines; the `awk` command is then prefixing those
with the last token (and a tab). Then sorting, so that records
are sorted by the last token, and then removing that token (and
the tab).
And, of course, whatever the above command line is doing [...]
One could, of course, do this in a single `awk` invocation. I
suspect it would be rather more awkward.
[...][...]
I saw this and it made me wonder whether one could just use the
`sort` command directly, and tell it to sort using the second
field. However, some records don't _have_ a second key (they're
single word) and some have 3 (some records have a middle initial
for instance); these are things that the `sort` command just
cannot handle, sadly.
Then it made me think that it would be nice if there was a way
to rotate the fields on a line; sadly, I'm not aware of a
standard command that does that. But it's not too hard to write
as its own little script.
You then have something like,
`sed 's/, */\n'g' data | rotwords -r | sort | rotwords -l`
`rotwords -r` does a right-rotation (so the last field is moved
to the front) and `rotwords -l` does a left rotation (so the
first field is moved to the rear).
It was kind of a fun exercise.
Michael S <[email protected]> writes:
Methinks, the segment of the industry that employed you for last nn
(40?) years is an exception rather than rule.
Computer system manufacturers and fabless semiconductor
companies. Mainframes, Minicomputers, MPP machines, complex SOCs.
Operating systems, hypervisors, simulators, firmware.
Granted, I've never worked in web services space (aside a
couple of years at the dot-com bust spent working on a Java-based B2B XML data-flow engine with some of the ex-SUN Java developers).
On Tue, 21 Apr 2026 17:38:03 GMT
[email protected] (Scott Lurndal) wrote:
Bart <[email protected]> writes:
On 21/04/2026 16:33, DFS wrote:
On 4/21/2026 11:08 AM, Bart wrote:
It didn't give any examples of what the output needs to look, at
least not in your OP. (They can see it by running your
submission, but it says no peeking.)
You don't really need all that handholding do you?
None of those issues would be typical of what the PHB would ask
you to do. "Sort this list by last name then first name" is all
I would expect to get. Asking about case-sensitivity and 4 names
and whitespace would make you look like a ninny.
You seem to be confusing a comic strip with reality.
In the real world, for professional developers, detailed
specifications are common. Forty years ago, detailed
specifications were common (we had three levels of
specification for each project back in 1983; a concept
spec, a detailed specification and a test specification).
Even the two startups I've been associated with had clear
and concise specifications for each project.
Methinks, the segment of the industry that employed you for last nn
(40?) years is an exception rather than rule.
In industry as a whole imprecise specs are far more common. Also, specs
are not constant. If the software is user-facing then the biggest batch
of clarifications of the spec tend to come after alpha version was
shipped to friendly customers. But even after that if the project is
not dead then there tends to be continuous flow of changes and
clarifications of specs.
As usual - in a superior language.
#include <iostream>
#include <utility>
#include <string_view>
#include <regex>
#include <vector>
#include <algorithm>
using namespace std;
static constexpr string_view Names = "Martin Hohenberg, Jae Yang, Tim
Bando, Daniel Garber, Kyle Burkholder, Mike Nichols, Mark Ping, Tom
Taylor, Arnold F. Williams, George Brower, Michael Nygard, Brendan Long, Sven Dowideit, Dave Witten, Jonathan Cast, James Cronin, David L.
Jessup, Christopher Chang, Killer Delicious, Jacob Lyles, Neil
Anuskiewicz, Mordant, Clemens Ladisch, Wojciech Woytniak, Masa Bando,
John Carmack, Xingyu Wang, Jane Tang, Steven Evans, Jan Roudaut, Hsueh
Sung, Ken LaCrosse, taishi28012, John Simpson, Jerod Tufte, Paul Abbott, Stan Witherspoon, Donald Greer, Gratiela Chergu, Michael Ciagala, Dale Carstensen, Chip Davis, Liudmilla Karukina, Jim McCloskey, Dewey Sasser,
Hal Hildebrand, Connor Wood, Ken Kennedy, darrin, Mark Gardner, William Christensen, Malcolm Ocean, Rod Davenport, Nodarius Darjania, Cheryl
Evry, Wenfeng Liang, Irving Rivas, Bill Soistman, ReallyBored, Άρης Δάσος, Ron Lauzon, TheFred, Paul Theodoropolous, Doug Phillips, Les Vogel, Matt Pollard, Andres Cordova";
int main()
{
regex
rxComma( "\\s*([^,]+)(,|$)" ),
rxRvSurname( "\\s*(\\S+)" ),
rxGapSpaces( "(\\s+)" );
match_results<string_view::iterator> mtch;
match_results<string_view::reverse_iterator> reverseMatch;
using name = pair<string_view, string_view>;
vector<name> names;
for( auto itName = ::Names.begin(); ; itName = mtch[0].second )
{
if( !regex_search( itName, ::Names.end(), mtch, rxComma ) )
break;
if( !regex_search( reverse_iterator( mtch[1].second ), reverse_iterator( mtch[1].first ), reverseMatch, rxRvSurname ) )
continue;
auto
itSurname = reverseMatch[1].second.base(),
itSurnameEnd = reverseMatch[1].first.base();
string_view surname( itSurname, itSurnameEnd );
auto itForename = mtch[1].first;
if( !regex_search( reverse_iterator( itSurname ), reverse_iterator( itForename ), reverseMatch, rxGapSpaces ) )
continue;
auto itForenameEnd = reverseMatch[1].second.base();
string_view forename( itForename, itForenameEnd );
names.emplace_back( forename, surname );
}
sort( names.begin(), names.end(), []( const name &lhs, const name &rhs ) { return lhs.second < rhs.second; } );
for( const name &nm : names )
{
cout << "\"" << nm.first << "\" - \"" << nm.second << "\"" <<
endl;
}
}
The cool thing about that that I'm matching a part of the name with
a reverse-iterator, i.e. I do reverse regex parsing (the regex itself
is forward).
On 4/16/2026 12:24 PM, Bonita Montero wrote:[...]
As usual - in a superior language.
I found the definitive explanation of the visual impact of C++:
"C++ looks like someone threw up on your screen"
https://www.quora.com/Which-programming-language-has-the-most-visually-clean-syntax-in-your-opinion
On 21/04/2026 19:50, Michael S wrote:
On Tue, 21 Apr 2026 17:38:03 GMT
[email protected] (Scott Lurndal) wrote:
Bart <[email protected]> writes:
On 21/04/2026 16:33, DFS wrote:
On 4/21/2026 11:08 AM, Bart wrote:
It didn't give any examples of what the output needs to look, at
least not in your OP. (They can see it by running your
submission, but it says no peeking.)
You don't really need all that handholding do you?
None of those issues would be typical of what the PHB would ask
you to do. "Sort this list by last name then first name" is all
I would expect to get. Asking about case-sensitivity and 4
names and whitespace would make you look like a ninny.
You seem to be confusing a comic strip with reality.
In the real world, for professional developers, detailed
specifications are common. Forty years ago, detailed
specifications were common (we had three levels of
specification for each project back in 1983; a concept
spec, a detailed specification and a test specification).
Even the two startups I've been associated with had clear
and concise specifications for each project.
Methinks, the segment of the industry that employed you for last nnOr perhaps he has just been lucky.
(40?) years is an exception rather than rule.
In industry as a whole imprecise specs are far more common. Also,
specs are not constant. If the software is user-facing then the
biggest batch of clarifications of the spec tend to come after
alpha version was shipped to friendly customers. But even after
that if the project is not dead then there tends to be continuous
flow of changes and clarifications of specs.
I've had specifications (for hardware and software - we typically doThe worst is when client, instead of telling you what result he wants to
both) from customers that were hundreds of pages long, so detailed
that they were basically impossible to fulfil.
At the other end ofWhat it was?
the scale, we made a control system for a CNC saw machine where the
only concrete specification was the colour it should be painted.
Often the process of helping turning customers' ideas into some kind
of reasonable specification is part of the service we provide. And
usually there is a continuum as specifications change along the way
(as you describe).
On Wed, 22 Apr 2026 09:18:05 +0200
David Brown <[email protected]> wrote:
On 21/04/2026 19:50, Michael S wrote:
On Tue, 21 Apr 2026 17:38:03 GMTOr perhaps he has just been lucky.
[email protected] (Scott Lurndal) wrote:
Bart <[email protected]> writes:
On 21/04/2026 16:33, DFS wrote:
On 4/21/2026 11:08 AM, Bart wrote:
It didn't give any examples of what the output needs to look, at >>>>>>> least not in your OP. (They can see it by running your
submission, but it says no peeking.)
You don't really need all that handholding do you?
None of those issues would be typical of what the PHB would ask
you to do. "Sort this list by last name then first name" is all >>>>>> I would expect to get. Asking about case-sensitivity and 4
names and whitespace would make you look like a ninny.
You seem to be confusing a comic strip with reality.
In the real world, for professional developers, detailed
specifications are common. Forty years ago, detailed
specifications were common (we had three levels of
specification for each project back in 1983; a concept
spec, a detailed specification and a test specification).
Even the two startups I've been associated with had clear
and concise specifications for each project.
Methinks, the segment of the industry that employed you for last nn
(40?) years is an exception rather than rule.
In industry as a whole imprecise specs are far more common. Also,
specs are not constant. If the software is user-facing then the
biggest batch of clarifications of the spec tend to come after
alpha version was shipped to friendly customers. But even after
that if the project is not dead then there tends to be continuous
flow of changes and clarifications of specs.
I'd guess, it has more to do with being in the middle of solution stack rather than on one or another edge.
In the middle specs are more stable and precise.
I've had specifications (for hardware and software - we typically do
both) from customers that were hundreds of pages long, so detailed
that they were basically impossible to fulfil.
The worst is when client, instead of telling you what result he wants to
get, insists on specifying how to do it.
Personally, when I see customer like that I look for way of not being involved in the project. Because the most common end results is both
sides dissatisfied. But that is not the worst part of it. A mutual
stress during whole process of development is worse.
At the other end of
the scale, we made a control system for a CNC saw machine where the
only concrete specification was the colour it should be painted.
What it was?
Often the process of helping turning customers' ideas into some kind
of reasonable specification is part of the service we provide. And
usually there is a continuum as specifications change along the way
(as you describe).
On 22/04/2026 12:22, Michael S wrote:
On Wed, 22 Apr 2026 09:18:05 +0200
David Brown <[email protected]> wrote:
At the other end of
the scale, we made a control system for a CNC saw machine where the
only concrete specification was the colour it should be painted.
What it was?
It was a multi-saw system for cutting roof beams with different sizes
and angles. We talked to the folks who made the mechanics, and we
talked a lot to the guy who was going to be using the machine in the
end, so we made a very successful system in the end. The customer
himself had no idea - but he paid his bills, so everyone was happy.
On Wed, 22 Apr 2026 12:38:13 +0200
David Brown <[email protected]> wrote:
On 22/04/2026 12:22, Michael S wrote:
On Wed, 22 Apr 2026 09:18:05 +0200
David Brown <[email protected]> wrote:
At the other end of
the scale, we made a control system for a CNC saw machine where the
only concrete specification was the colour it should be painted.
What it was?
It was a multi-saw system for cutting roof beams with different sizes
and angles. We talked to the folks who made the mechanics, and we
talked a lot to the guy who was going to be using the machine in the
end, so we made a very successful system in the end. The customer
himself had no idea - but he paid his bills, so everyone was happy.
I was asking what colour it was.
DFS <[email protected]> writes:
On 4/16/2026 12:24 PM, Bonita Montero wrote:[...]
As usual - in a superior language.
I found the definitive explanation of the visual impact of C++:
"C++ looks like someone threw up on your screen"
https://www.quora.com/Which-programming-language-has-the-most-visually-clean-syntax-in-your-opinion
Bonita's habit of posting C++ code to comp.lang.c is inappropriate.
Debating the merits of C++ is equally inappropriate.
On 4/16/2026 12:24 PM, Bonita Montero wrote:
As usual - in a superior language.
I found the definitive explanation of the visual impact of C++:
"C++ looks like someone threw up on your screen"
[snip link]
On 22/04/2026 12:22, Michael S wrote:
On Wed, 22 Apr 2026 09:18:05 +0200
David Brown <[email protected]> wrote:
On 21/04/2026 19:50, Michael S wrote:
On Tue, 21 Apr 2026 17:38:03 GMT
[email protected] (Scott Lurndal) wrote:
In the real world, for professional developers, detailed
specifications are common. Forty years ago, detailed
specifications were common (we had three levels of
specification for each project back in 1983; a concept
spec, a detailed specification and a test specification).
Even the two startups I've been associated with had clear
and concise specifications for each project.
Methinks, the segment of the industry that employed you for last nn
(40?) years is an exception rather than rule. [...]
I'd guess, it has more to do with being in the middle of solution stack
rather than on one or another edge.
In the middle specs are more stable and precise.
That makes sense. Different parts of a job typically have different
levels of specification. And it can also vary depending on how many
people are working on the project - big tasks require more detail and
more coordination for the different developers working on specialist parts. For smaller projects and groups (we are quite a small
development group), it can be more practical to leave things up to the developer to decide.
I've had specifications (for hardware and software - we typically do
both) from customers that were hundreds of pages long, so detailed
that they were basically impossible to fulfil.
The worst is when client, instead of telling you what result he wants to
get, insists on specifying how to do it.
That can be bad, yes - especially when you know there are better ways to handle things. Or when you tell the customer their solution is
impossible and they need to do it another way, and they tell you they've already made all the marketing material and dummy models before ever
talking to the technical people. You see that especially from startup companies from business schools - they have their idea, their finance people, their marketing people, their sales people, their slogans,
websites, promotional videos, cost projections, etc., and only then, six weeks before they have planned delivery, do they talk to someone who can make electronics or write a program.
(It sounds like I am complaining - the majority of my customers have
been fine. Not all projects work out in the end, but that can be for
many reasons.)
Personally, when I see customer like that I look for way of not being
involved in the project. Because the most common end results is both
sides dissatisfied.
But that is not the worst part of it. A mutual
stress during whole process of development is worse.
Concerning Bonita's language of choice, C++, it should be remindedCompletely off-topic and of no importance, I'm just curious:
that he usually ...
Completely off-topic and of no importance, I'm just curious:
I would have thought, based upon my experiences with latin languages,
that Bonita would be a woman's name. Has Bonita said that Bonita is
male? I only see other people's responses to Bonita's messages, so I
would probably have missed it.
On 2026-04-23 03:27, James Kuyper wrote:
Completely off-topic and of no importance, I'm just curious:
I would have thought, based upon my experiences with latin languages,
that Bonita would be a woman's name. Has Bonita said that Bonita is
male? I only see other people's responses to Bonita's messages, so I
would probably have missed it.
You are most probably right; both, Bonita and Montero, appear to be
of Spanish origin. And I was sloppy in addressing her correctly. 8-/
My sincere apologies to Bonita! - I somehow and wrongly thought that
it was a pseudonym; probably because I think she's a German resident,
but then there's also residents in Germany with Greek names.[*] ;-)
It's the internet. Anyone can be anyone. Bonita posts
auf Deutschland and has a profile pic on Stack Overflow,
FWIW.
On 4/22/2026 6:16 AM, Keith Thompson wrote:[...]
Bonita's habit of posting C++ code to comp.lang.c is inappropriate.
Debating the merits of C++ is equally inappropriate.
So is discussing sorting algorithms.
DFS <[email protected]> writes:
On 4/16/2026 12:24 PM, Bonita Montero wrote:[...]
As usual - in a superior language.
I found the definitive explanation of the visual impact of C++:
"C++ looks like someone threw up on your screen"
https://www.quora.com/Which-programming-language-has-the-most-visually-clean-syntax-in-your-opinion
Bonita's habit of posting C++ code to comp.lang.c is inappropriate.
Debating the merits of C++ is equally inappropriate.
On 4/16/2026 12:24 PM, Bonita Montero wrote:
As usual - in a superior language.
I found the definitive explanation of the visual impact of C++:
"C++ looks like someone threw up on your screen"
https://www.quora.com/Which-programming-language-has-the-most-visually- clean-syntax-in-your-opinion
Discussing sorting algorithms is perfectly appropriate, if the
discussion also has something to do with the C language or how
to write programs in C.
Am 23.04.2026 um 17:11 schrieb Tim Rentsch:
Discussing sorting algorithms is perfectly appropriate, if the
discussion also has something to do with the C language or how
to write programs in C.
If the current context loses its connection to C, it's off-topic.
So you're not following your own rules. I might as well post C++
code. ;-)
[*] Serves me right. Some time ago I was wrongly addressed as female
because of the association with the phonetic similar Janice and with
the famous Janis Joplin being obviously female. Now given the famous
Yanis Varoufakis things should be more obvious.
Bonita posts auf Deutschland and has a profile
pic on Stack Overflow, FWIW.
[...] (I doubt that Yanis
Varoufakis is famous outside Greece, so that's not likely to be
helpful.)
On 4/23/2026 10:45 AM, Scott Lurndal wrote:
Bonita posts auf Deutschland and has a profile
pic on Stack Overflow, FWIW.
https://chat.stackoverflow.com/users/6469690/bonita-montero
That 2021? profile pic shows a seemingly young female. But Montero
trolls clc aggressively like a male - its clc behavior is extremely
unusual for a female.
Montero, is that you in the pic? How old are you?
On 2026-04-24 01:36, Keith Thompson wrote:
[...] (I doubt that Yanis
Varoufakis is famous outside Greece, so that's not likely to be
helpful.)
Oh, I'm positive that's not true! - Myself I certainly don't know
him from Greece, since I'm not living in that country. - Not sure
where you're residing, but he's famous (or infamous) in Europe at
least since the Euro-crisis 20 years ago! - He also studied in GB
and later became university teacher in Essex and Cambridge. And
finally he also became visiting professor in the US (Austin/Texas).
Frankly, I wonder that you missed his name completely. But, okay,
he's not technician but an economist. And so he's probably better
known in Europe than in the US.
That 2021? profile pic shows a seemingly young female. But Montero
trolls clc aggressively like a male - its clc behavior is extremely
unusual for a female.
That 2021? profile pic shows a seemingly young female. But Montero
trolls clc aggressively like a male - its clc behavior is extremely
unusual for a female.
On 4/23/2026 10:45 AM, Scott Lurndal wrote:
Bonita posts auf Deutschland and has a profile
pic on Stack Overflow, FWIW.
https://chat.stackoverflow.com/users/6469690/bonita-montero
That 2021? profile pic shows a seemingly young female. But Montero
trolls clc aggressively like a male - its clc behavior is extremely
unusual for a female.
Montero, is that you in the pic? How old are you?
On 2026-04-23 03:27, James Kuyper wrote:
Completely off-topic and of no importance, I'm just curious:
I would have thought, based upon my experiences with latin
languages, that Bonita would be a woman's name. Has Bonita said
that Bonita is male? I only see other people's responses to
Bonita's messages, so I would probably have missed it.
You are most probably right; both, Bonita and Montero, appear to be
of Spanish origin.
On Thu, 23 Apr 2026 15:51:13 +0200
Janis Papanagnou <[email protected]> wrote:
You are most probably right; both, Bonita and Montero, appear to be
of Spanish origin.
Majority of hits by search engines suggests either Mitsubishi vehicle,
which is known as Pajero in majority of Europe, supposedly including
Germany, or album of American rapper, named after said vehicle.
DFS <[email protected]> writes:
On 4/23/2026 10:45 AM, Scott Lurndal wrote:
Bonita posts auf Deutschland and has a profile
pic on Stack Overflow, FWIW.
https://chat.stackoverflow.com/users/6469690/bonita-montero
That 2021? profile pic shows a seemingly young female. But Montero
trolls clc aggressively like a male - its clc behavior is extremely
unusual for a female.
Montero, is that you in the pic? How old are you?
This kind of inquiry is inappropriate.
Janis Papanagnou <[email protected]> writes:
On 2026-04-24 01:36, Keith Thompson wrote:
[...] (I doubt that Yanis
Varoufakis is famous outside Greece, so that's not likely to be
helpful.)
Oh, I'm positive that's not true! - Myself I certainly don't know
him from Greece, since I'm not living in that country. - Not sure
where you're residing, but he's famous (or infamous) in Europe at
least since the Euro-crisis 20 years ago! - He also studied in GB
and later became university teacher in Essex and Cambridge. And
finally he also became visiting professor in the US (Austin/Texas).
Frankly, I wonder that you missed his name completely. But, okay,
he's not technician but an economist. And so he's probably better
known in Europe than in the US.
I'm American. We're barely aware that Europe exists. 8-)}
Am 22.04.2026 um 11:33 schrieb DFS:
On 4/16/2026 12:24 PM, Bonita Montero wrote:
As usual - in a superior language.
I found the definitive explanation of the visual impact of C++:
"C++ looks like someone threw up on your screen"
https://www.quora.com/Which-programming-language-has-the-most-visually- clean-syntax-in-your-opinion
For an average C++-developer that's easy.
The problem is not the language but you.
Tim Rentsch <[email protected]> writes:
Keith Thompson <[email protected]> writes:
Tim Rentsch <[email protected]> writes:
[...]
The semantics of !ptr has been codified to mean 1 for null pointers
since the original C standard. Heck, even during the 1970s when C
allowed assigning integers directly to pointers, K&R said that
assigning 0 to a pointer produces a pointer guaranteed to be
different than a pointer to any object. Any C implementation where
!ptr does the wrong thing should be avoided like the plague.
Any C implementation where !ptr does the wrong thing almost certainly
does not exist. It's difficult to imagine that a C compiler with
such a fundamental bug would ever go out the door.
My usual preference is to draw conclusions based on evidence rather
imagination or supposition.
Good for you.
It's barely possible that compiler that uses a representation other
than all-bits-zero for null pointers might have such a bug, but
(a) anyone creating such an implementation will almost certainly
be extremely careful to get such things right, and (b) I'm not sure
that any such compilers even exist, except perhaps for old systems
that would be considered exotic today.
Here again this sounds like just supposition. How much experience
do you have, and how extensive, using non-mainstream C compilers?
For myself I can't say I much at all, but I have seen one where
believe it or not assert() was implemented wrongly. assert()! I
certainly wouldn't have guessed that before actually seeing it.
Quick summary: You wrote that "Any C implementation where !ptr does
the wrong thing should be avoided like the plague." My response
was, to summarize briefly, that such implementations are unlikely
to exist and not worth worrying about.
Do you disagree, or are you just criticizing the way I said it?
I believe I was clear about the basis for my statement. No, I don't
have a lot of experience with non-mainstream C compilers. I'm not
going to perform a survey of all historical C implementations.
Do you have anything useful to say about my point, as opposed to
how I expressed it?
Keith Thompson <[email protected]> writes:
Tim Rentsch <[email protected]> writes:
Keith Thompson <[email protected]> writes:
Tim Rentsch <[email protected]> writes:
[...]
The semantics of !ptr has been codified to mean 1 for null pointers
since the original C standard. Heck, even during the 1970s when C
allowed assigning integers directly to pointers, K&R said that
assigning 0 to a pointer produces a pointer guaranteed to be
different than a pointer to any object. Any C implementation where
!ptr does the wrong thing should be avoided like the plague.
Any C implementation where !ptr does the wrong thing almost certainly
does not exist. It's difficult to imagine that a C compiler with
such a fundamental bug would ever go out the door.
My usual preference is to draw conclusions based on evidence rather
imagination or supposition.
Good for you.
It's barely possible that compiler that uses a representation other
than all-bits-zero for null pointers might have such a bug, but
(a) anyone creating such an implementation will almost certainly
be extremely careful to get such things right, and (b) I'm not sure
that any such compilers even exist, except perhaps for old systems
that would be considered exotic today.
Here again this sounds like just supposition. How much experience
do you have, and how extensive, using non-mainstream C compilers?
For myself I can't say I much at all, but I have seen one where
believe it or not assert() was implemented wrongly. assert()! I
certainly wouldn't have guessed that before actually seeing it.
Quick summary: You wrote that "Any C implementation where !ptr does
the wrong thing should be avoided like the plague." My response
was, to summarize briefly, that such implementations are unlikely
to exist and not worth worrying about.
You said "Any C implementation where !ptr does the wrong thing
almost certainly does not exist."
Do you disagree, or are you just criticizing the way I said it?
I was simply drawing attention to the circumstance of your having
made a statement of fact without offering any facts to support it.
I believe I was clear about the basis for my statement. No, I don't
have a lot of experience with non-mainstream C compilers. I'm not
going to perform a survey of all historical C implementations.
Do you have anything useful to say about my point, as opposed to
how I expressed it?
As far as I can tell your point is that you don't mind offering
unsupported allegations as facts. In my opinion it is useful
to have that attitude pointed out.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,114 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 492515:55:09 |
| Calls: | 14,267 |
| Calls today: | 3 |
| Files: | 186,321 |
| D/L today: |
27,599 files (9,006M bytes) |
| Messages: | 2,518,520 |