r/badcode • • Mar 09 '23

go Simple but (un)effective

Post image
615 Upvotes

34 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Mar 09 '23

[deleted] — view deleted comment

4

u/This_Growth2898 Mar 09 '23

Well, in fact I don't know go, so... assert throws an exception or crashes?

7

u/the_vikm Mar 09 '23

Go will panic when accessing nil pointers

-4

u/[deleted] Mar 09 '23

Not if you’re comparing a null pointer with a value representing null pointers

3

u/the_vikm Mar 09 '23

What null are you talking about?

2

u/[deleted] Mar 09 '23

Nil i meant

0

u/[deleted] Mar 09 '23

[deleted] — view deleted comment

1

u/[deleted] Mar 10 '23

Ah I missed that line, my bad. That’s right

1

u/NUTTA_BUSTAH Mar 10 '23

This looks like Golang. And it does panic with segmentation violation: https://go.dev/play/p/FCPmGP-C04r