News for hackers. Stuff that matters.
Re:Reversing Go Binaries Like a Pro by razakel on Friday December 16, 2016 @04:23AM (#13192076)
>Just curious, is a Go string a C string inside (rune array + nil) or a proper class array?

I can't imagine how you would even implement a string as anything other than a rune array.

Even a Pascal string is just the string length followed by characters.

Re:Reversing Go Binaries Like a Pro by chrisseaton on Friday December 16, 2016 @06:54AM (#13192635)
> I can't imagine how you would even implement a string as anything other than a rune array.

You can also implement strings using a tree data structure. We do this in an implementation of Ruby that I work on because it can make concatenation faster.

Re:Reversing Go Binaries Like a Pro by Someone on Friday December 16, 2016 @07:24AM (#13192761)
A text editor edits a (potentially very long) string, but apart from, possibly, the likes of Notepad, none of them store that string as a single byte array.

So, look at text editor data structures for other representations. Examples:

- https://en.wikipedia.org/wiki/Gap_buffer

- https://en.wikipedia.org/wiki/Rope_(computer_science)

- https://en.wikipedia.org/wiki/Piece_table

Re:Reversing Go Binaries Like a Pro by unwind on Friday December 16, 2016 @07:50AM (#13192872)
In Haskell strings are lists of characters (https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-S...). I hear not everyone is thrilled with the performance implications. :)

Also not a Haskell programmer, and really not meaning to criticize. Haskell seems awesome and I should learn it some day.

Re:Reversing Go Binaries Like a Pro by jerf on Friday December 16, 2016 @08:28AM (#13193060)
Just so people know, there are arrays used for text manipulation in Haskell in the Data.Text library, and bytestrings in the ByteString library. The language as specified does indeed have strings in a linked list of numbers, but if you even remotely care about performance you don't use those, and most libraries don't either nowadays.
Re:Reversing Go Binaries Like a Pro by unwind on Monday December 19, 2016 @04:06AM (#13210345)
Thanks! I guess I was kind of hoping for someone with actual knowledge to fill in the details.
Re:Reversing Go Binaries Like a Pro by thwd on Friday December 16, 2016 @06:40AM (#13192572)
as C does: with a \00 end marker.
Re:Reversing Go Binaries Like a Pro by javathrowaway on Friday December 16, 2016 @09:40AM (#13193488)
Yeah, and how do you store NUL chars in those C strings then?

The answer is you can't. Because prefix-length strings (Pascal) are far better than null-terminated (C) strings.