Re: [go-nuts] Doing "C-like" things in Go

2017-09-19 Thread roger peppe
On 11 September 2017 at 17:56, CampNowhere wrote: > I am a C developer and am trying to pick up Go. > > My question is this. C doesn't "care" about truthfulness, it just cares > about zero and non-zero when evaluating a logical AND operator. So something > like the following in C is totally kosher

Re: [go-nuts] Doing "C-like" things in Go

2017-09-18 Thread Scott Pakin
On Monday, September 11, 2017 at 7:25:54 PM UTC-6, Michael Jones wrote: > > int(boolvalue) could mean 0 for false and 1 otherwise > bool(intvalue) could mean false for 0 an true otherwise > > quite a useful notion > Yeah, too bad that was shot down years ago (cf. proposal: support int(bool) conv

Re: [go-nuts] Doing "C-like" things in Go

2017-09-12 Thread Konstantin Khomoutov
On Mon, Sep 11, 2017 at 09:56:59AM -0700, CampNowhere wrote: > I am a C developer and am trying to pick up Go. > > My question is this. C doesn't "care" about truthfulness, it just cares > about zero and non-zero when evaluating a logical AND operator. So > something like the following in C is t

Re: [go-nuts] Doing "C-like" things in Go

2017-09-11 Thread Michael Jones
That said: int(boolvalue) could mean 0 for false and 1 otherwise bool(intvalue) could mean false for 0 an true otherwise quite a useful notion On Mon, Sep 11, 2017 at 5:12 PM, Shawn Milochik wrote: > Go is more explicit than C. Mistakes won't compile. Perfectly valid syntax > in C could be a s

Re: [go-nuts] Doing "C-like" things in Go

2017-09-11 Thread Shawn Milochik
Go is more explicit than C. Mistakes won't compile. Perfectly valid syntax in C could be a subtle logic bug; Go tries to avoid these. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it

[go-nuts] Doing "C-like" things in Go

2017-09-11 Thread CampNowhere
I am a C developer and am trying to pick up Go. My question is this. C doesn't "care" about truthfulness, it just cares about zero and non-zero when evaluating a logical AND operator. So something like the following in C is totally kosher: int a = 10; int b = 20; while(a && b) { do_somethi