Re: [9fans] inequality testing in shell

2015-06-15 Thread erik quanstrom
On Sun Jun 14 14:12:13 PDT 2015, nsa...@gmail.com wrote:
 Why doesn't the plan9 test program have features for checking
 inequalities (i.e. greater than etc.)?
 What do you guys do when you want to test for inequality?
 
 Maybe the most convenient way to do that in the shell would be if I
 made two tiny programs, lt  gt which would check their two arguments.

to be more pedantic than necessary, test is not part of the plan 9 shell.
the ~ operator is the way to test for (string) equality or inequality.
! is shell negation, so for non-negative integral x,

~ $x [1-3]  - x  4
! ~ $x [1-3]- x = 4

the shell doesn't understand numbers.

outside the shell, hoc or awk are alternatives to test

- erik



Re: [9fans] make passive aggressive gcc

2015-06-15 Thread Ethan Grammatikidis
On Mon, 15 Jun 2015 09:21:56 +0100
Charles Forsyth charles.fors...@gmail.com wrote:

 If you're using gcc 4.8.2 to compile ... anything, really ... but certainly
 Plan 9 or Inferno components,
 and those use for loops with arrays, be sure to include the compilation
 options
 -fno-strict-aliasing\
 -fno-aggressive-loop-optimizations\
 and it will save you some time and effort.
 It will save compilation time (not that you'll notice with that sluggard)
 because it won't
 fuss even more with your program, and it will save effort, because you
 won't have
 to debug simple loops that have bounds changed, are removed completely, or
 otherwise wrecked.
 You can find discussions of it elsewhere (which is how I found compiler
 options to stop it).
 I'd forgotten all about it until it surfaced again.

Thanks. Reminds me I liked gcc when it applied very few optimizations.
I guess it must have been focused on machine-specific optimizations
back in 2007/2008. I had a cpu newer than gcc had support for, and
compilation was actually quick. Anyone know if -O0 is a reasonable
option these days? (I mean tested well enough to be reasonably
bug-free.)

-- 
Developing the austere intellectual discipline of keeping things
sufficiently simple is in this environment a formidable challenge,
both technically and educationally.
 -- Dijstraka, EWD898, 1984



Re: [9fans] make passive aggressive gcc

2015-06-15 Thread Ryan Gonzalez
Ugh, I know. It caused Judy arrays to segfault a lot.

From my personal experience, Clang does *not* have this problem.


On June 15, 2015 3:21:56 AM CDT, Charles Forsyth charles.fors...@gmail.com 
wrote:
If you're using gcc 4.8.2 to compile ... anything, really ... but
certainly
Plan 9 or Inferno components,
and those use for loops with arrays, be sure to include the compilation
options
-fno-strict-aliasing\
-fno-aggressive-loop-optimizations\
and it will save you some time and effort.
It will save compilation time (not that you'll notice with that
sluggard)
because it won't
fuss even more with your program, and it will save effort, because you
won't have
to debug simple loops that have bounds changed, are removed completely,
or
otherwise wrecked.
You can find discussions of it elsewhere (which is how I found compiler
options to stop it).
I'd forgotten all about it until it surfaced again.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Re: [9fans] make passive aggressive gcc

2015-06-15 Thread Siarhei Zirukin
On Mon, Jun 15, 2015 at 3:41 PM, Ethan Grammatikidis
eeke...@fastmail.fm wrote:
 On Mon, 15 Jun 2015 09:21:56 +0100
 Charles Forsyth charles.fors...@gmail.com wrote:

 If you're using gcc 4.8.2 to compile ... anything, really ... but certainly
 Plan 9 or Inferno components,
 and those use for loops with arrays, be sure to include the compilation
 options
 -fno-strict-aliasing\
 -fno-aggressive-loop-optimizations\
 and it will save you some time and effort.
 It will save compilation time (not that you'll notice with that sluggard)
 because it won't
 fuss even more with your program, and it will save effort, because you
 won't have
 to debug simple loops that have bounds changed, are removed completely, or
 otherwise wrecked.
 You can find discussions of it elsewhere (which is how I found compiler
 options to stop it).
 I'd forgotten all about it until it surfaced again.

 Thanks. Reminds me I liked gcc when it applied very few optimizations.
 I guess it must have been focused on machine-specific optimizations
 back in 2007/2008. I had a cpu newer than gcc had support for, and
 compilation was actually quick. Anyone know if -O0 is a reasonable
 option these days? (I mean tested well enough to be reasonably
 bug-free.)

I've recenetly seen a few examples where -O0 would produce a
segfaulting executable, while any other -Ox would work fine.
Also, I don't know what gcc authors are smoking, but strcpy(tmp,
what.); will be compiled to a few mov instructions with -O0, while
-Os still has a call to strcpy, just the way it *should* always be,
imho. I just checked this once again (gcc-4.8.4) and it still applies.



Re: [9fans] make passive aggressive gcc

2015-06-15 Thread Ethan Grammatikidis
On Mon, 15 Jun 2015 16:56:28 +0200
Siarhei Zirukin ftrvxm...@gmail.com wrote:

 On Mon, Jun 15, 2015 at 3:41 PM, Ethan Grammatikidis
 eeke...@fastmail.fm wrote:
  On Mon, 15 Jun 2015 09:21:56 +0100
  Charles Forsyth charles.fors...@gmail.com wrote:
 
  If you're using gcc 4.8.2 to compile ... anything, really ... but certainly
  Plan 9 or Inferno components,
  and those use for loops with arrays, be sure to include the compilation
  options
  -fno-strict-aliasing\
  -fno-aggressive-loop-optimizations\
  and it will save you some time and effort.
  It will save compilation time (not that you'll notice with that sluggard)
  because it won't
  fuss even more with your program, and it will save effort, because you
  won't have
  to debug simple loops that have bounds changed, are removed completely, or
  otherwise wrecked.
  You can find discussions of it elsewhere (which is how I found compiler
  options to stop it).
  I'd forgotten all about it until it surfaced again.
 
  Thanks. Reminds me I liked gcc when it applied very few optimizations.
  I guess it must have been focused on machine-specific optimizations
  back in 2007/2008. I had a cpu newer than gcc had support for, and
  compilation was actually quick. Anyone know if -O0 is a reasonable
  option these days? (I mean tested well enough to be reasonably
  bug-free.)
 
 I've recenetly seen a few examples where -O0 would produce a
 segfaulting executable, while any other -Ox would work fine.
 Also, I don't know what gcc authors are smoking, but strcpy(tmp,
 what.); will be compiled to a few mov instructions with -O0, while
 -Os still has a call to strcpy, just the way it *should* always be,
 imho. I just checked this once again (gcc-4.8.4) and it still applies.
 

So -O0 hasn't improved since 2008 then. Time to switch to clang, I
guess.

-- 
Developing the austere intellectual discipline of keeping things
sufficiently simple is in this environment a formidable challenge,
both technically and educationally.
 -- Dijstraka, EWD898, 1984



Re: [9fans] make passive aggressive gcc

2015-06-15 Thread dexen deVries

 I don't know what gcc authors are smoking, but strcpy(tmp,
 what.); will be compiled to a few mov instructions with -O0, while
 -Os still has a call to strcpy, just the way it *should* always be,
 imho.


not that it's any excuse, but -fno-builtin helps.

On Mon, Jun 15, 2015 at 4:56 PM, Siarhei Zirukin ftrvxm...@gmail.com
wrote:

 On Mon, Jun 15, 2015 at 3:41 PM, Ethan Grammatikidis
 eeke...@fastmail.fm wrote:
  On Mon, 15 Jun 2015 09:21:56 +0100
  Charles Forsyth charles.fors...@gmail.com wrote:
 
  If you're using gcc 4.8.2 to compile ... anything, really ... but
 certainly
  Plan 9 or Inferno components,
  and those use for loops with arrays, be sure to include the compilation
  options
  -fno-strict-aliasing\
  -fno-aggressive-loop-optimizations\
  and it will save you some time and effort.
  It will save compilation time (not that you'll notice with that
 sluggard)
  because it won't
  fuss even more with your program, and it will save effort, because you
  won't have
  to debug simple loops that have bounds changed, are removed completely,
 or
  otherwise wrecked.
  You can find discussions of it elsewhere (which is how I found compiler
  options to stop it).
  I'd forgotten all about it until it surfaced again.
 
  Thanks. Reminds me I liked gcc when it applied very few optimizations.
  I guess it must have been focused on machine-specific optimizations
  back in 2007/2008. I had a cpu newer than gcc had support for, and
  compilation was actually quick. Anyone know if -O0 is a reasonable
  option these days? (I mean tested well enough to be reasonably
  bug-free.)

 I've recenetly seen a few examples where -O0 would produce a
 segfaulting executable, while any other -Ox would work fine.
 Also, I don't know what gcc authors are smoking, but strcpy(tmp,
 what.); will be compiled to a few mov instructions with -O0, while
 -Os still has a call to strcpy, just the way it *should* always be,
 imho. I just checked this once again (gcc-4.8.4) and it still applies.




Re: [9fans] Wildly off-topic

2015-06-15 Thread Ramakrishnan Muthukrishnan
On Tue, Jun 16, 2015, at 04:52 AM, Bakul Shah wrote:
 On Tue, 16 Jun 2015 11:06:48 +1200 Andrew Simmons kod...@gmail.com
 wrote:
  As the subject line says, wildly off-topic. But some-one here might know =
  the answer, and it=E2=80=99s been bothering me.
  
  Such are my failings, I=E2=80=99ve been watching the second series of =
  =E2=80=9CHalt and Catch Fire=E2=80=9D in order to catch up with what the =
  kids are up to these days. In the second episode one of the characters =
  opens what looks like a copy of KR first edition, but the cover is =
  blue. I thought that the colour correction on my TV might be deceiving =
  me, or possibly the vertical hold was on the fritz, but he did it again =
  in the third episode, and the cover was still blue.
  
  So my question is, did there ever exist an edition of KR in that colour =
  scheme, or is gcc to blame for the inaccuracy?=
 
 Amazon trade ins of The C programming Language shows a cyan
 blue cover -- it says Eastern Economic Edition and it is the
 second edition.

Yes, I can confirm that. It is sold here in India. It used to be the
same white cover as the international edition (my copy from 1993,
eastern economy edition, has a white cover).

-- 
  Ramakrishnan



Re: [9fans] Wildly off-topic

2015-06-15 Thread Andrew Simmons

 On Jun 16, 2015, at 3:48 pm, Kim Shrier k...@westryn.net wrote:
 
 My copy of the first edition from 1978 has a white cover with blue lettering.
 
 Kim
 
 

Mine did too. The one on the show is clearly not the second edition, but has a 
light blue cover with darker blue lettering, apart from the “C”, which is red. 
Tragic obsessive, me??? I blame gcc.


Re: [9fans] Wildly off-topic

2015-06-15 Thread Kim Shrier
My copy of the first edition from 1978 has a white cover with blue lettering.

Kim




Re: [9fans] Wildly off-topic

2015-06-15 Thread Skip Tavakkolian
at one point there was a web page with images of many (maybe all) KR
C covers from various prints and translations.  i think it was a page
that dmr had created (or perhaps bwk, i can't remember exactly).  i
can't seem to find it now.

 On Jun 16, 2015, at 3:48 pm, Kim Shrier k...@westryn.net wrote:
 
 My copy of the first edition from 1978 has a white cover with blue lettering.
 
 Kim
 
 
 
 Mine did too. The one on the show is clearly not the second edition, but has 
 a light blue cover with darker blue lettering, apart from the “C”, which is 
 red. Tragic obsessive, me??? I blame gcc.




[9fans] make passive aggressive gcc

2015-06-15 Thread Charles Forsyth
If you're using gcc 4.8.2 to compile ... anything, really ... but certainly
Plan 9 or Inferno components,
and those use for loops with arrays, be sure to include the compilation
options
-fno-strict-aliasing\
-fno-aggressive-loop-optimizations\
and it will save you some time and effort.
It will save compilation time (not that you'll notice with that sluggard)
because it won't
fuss even more with your program, and it will save effort, because you
won't have
to debug simple loops that have bounds changed, are removed completely, or
otherwise wrecked.
You can find discussions of it elsewhere (which is how I found compiler
options to stop it).
I'd forgotten all about it until it surfaced again.


[9fans] Wildly off-topic

2015-06-15 Thread Andrew Simmons
As the subject line says, wildly off-topic. But some-one here might know the 
answer, and it’s been bothering me.

Such are my failings, I’ve been watching the second series of “Halt and Catch 
Fire” in order to catch up with what the kids are up to these days. In the 
second episode one of the characters opens what looks like a copy of KR first 
edition, but the cover is blue. I thought that the colour correction on my TV 
might be deceiving me, or possibly the vertical hold was on the fritz, but he 
did it again in the third episode, and the cover was still blue.

So my question is, did there ever exist an edition of KR in that colour 
scheme, or is gcc to blame for the inaccuracy?


Re: [9fans] Wildly off-topic

2015-06-15 Thread sl
 So my question is, did there ever exist an edition of KR in that
 colour scheme, or is gcc to blame for the inaccuracy?

The old web page for the book had a nice collection of covers from
around the world:

http://9p.io/cm/cs/cbook/index.html

sl



Re: [9fans] Wildly off-topic

2015-06-15 Thread Ryan Gonzalez
It's always GCC.

On Mon, Jun 15, 2015 at 6:06 PM, Andrew Simmons kod...@gmail.com wrote:

 As the subject line says, wildly off-topic. But some-one here might know
 the answer, and it’s been bothering me.

 Such are my failings, I’ve been watching the second series of “Halt and
 Catch Fire” in order to catch up with what the kids are up to these days.
 In the second episode one of the characters opens what looks like a copy of
 KR first edition, but the cover is blue. I thought that the colour
 correction on my TV might be deceiving me, or possibly the vertical hold
 was on the fritz, but he did it again in the third episode, and the cover
 was still blue.

 So my question is, did there ever exist an edition of KR in that colour
 scheme, or is gcc to blame for the inaccuracy?




-- 
Ryan
[ERROR]: Your autotools build scripts are 200 lines longer than your
program. Something’s wrong.
http://kirbyfan64.github.io/


Re: [9fans] Wildly off-topic

2015-06-15 Thread Bakul Shah
On Tue, 16 Jun 2015 11:06:48 +1200 Andrew Simmons kod...@gmail.com wrote:
 As the subject line says, wildly off-topic. But some-one here might know =
 the answer, and it=E2=80=99s been bothering me.
 
 Such are my failings, I=E2=80=99ve been watching the second series of =
 =E2=80=9CHalt and Catch Fire=E2=80=9D in order to catch up with what the =
 kids are up to these days. In the second episode one of the characters =
 opens what looks like a copy of KR first edition, but the cover is =
 blue. I thought that the colour correction on my TV might be deceiving =
 me, or possibly the vertical hold was on the fritz, but he did it again =
 in the third episode, and the cover was still blue.
 
 So my question is, did there ever exist an edition of KR in that colour =
 scheme, or is gcc to blame for the inaccuracy?=

Amazon trade ins of The C programming Language shows a cyan
blue cover -- it says Eastern Economic Edition and it is the
second edition.

http://www.amazon.com/Programming-Language-Brian-W-Kernighan/dp/8120305965/ref=sr_1_2?s=tradein-apssrs=9187220011ie=UTF8qid=1434409938sr=8-2keywords=the+c+programming+language



Re: [9fans] Wildly off-topic

2015-06-15 Thread Andrew Simmons
Thanks, but it seems as if that web page is for the 2nd edition. I have two 
copies of this, one of which is much thicker than the other, despite having the 
same number of pages, but that’s a different wildly off-topic topic. I used to 
have a copy of the 1st edition, and I’m sure that the background colour was 
white. Did there ever exist a version with a blue cover?

Also, I think that “It’s a fair cop, but gcc is to blame” should be an adequate 
defence in any court of law.


 On Jun 16, 2015, at 11:13 am, s...@9front.org wrote:
 
 So my question is, did there ever exist an edition of KR in that
 colour scheme, or is gcc to blame for the inaccuracy?
 
 The old web page for the book had a nice collection of covers from
 around the world:
 
   http://9p.io/cm/cs/cbook/index.html
 
 sl
 




Re: [9fans] Wildly off-topic

2015-06-15 Thread Kurt H Maier

Quoting Andrew Simmons kod...@gmail.com:


So my question is, did there ever exist an edition of KR in that


Quoting Andrew Simmons kod...@gmail.com:


Thanks, but it seems as if that web page is for the 2nd edition.


ok, still yes.

The linked page is for all editions.

khm




Re: [9fans] Wildly off-topic

2015-06-15 Thread Steven Stallion
ISTR the first edition cover was green on white, but that could have been a
reprint (or a faulty memory).

Steve

On Mon, Jun 15, 2015 at 6:28 PM, Andrew Simmons kod...@gmail.com wrote:

 Thanks, but it seems as if that web page is for the 2nd edition. I have
 two copies of this, one of which is much thicker than the other, despite
 having the same number of pages, but that’s a different wildly off-topic
 topic. I used to have a copy of the 1st edition, and I’m sure that the
 background colour was white. Did there ever exist a version with a blue
 cover?

 Also, I think that “It’s a fair cop, but gcc is to blame” should be an
 adequate defence in any court of law.


  On Jun 16, 2015, at 11:13 am, s...@9front.org wrote:
 
  So my question is, did there ever exist an edition of KR in that
  colour scheme, or is gcc to blame for the inaccuracy?
 
  The old web page for the book had a nice collection of covers from
  around the world:
 
http://9p.io/cm/cs/cbook/index.html
 
  sl