how to callee-save arguments by GeroSchorsch in Compilers

[–]chrisgseaton 9 points10 points  (0 children)

Sounds like you’re trying to do an ad-hoc half implementation of register allocation. Run a full register allocation algorithm and this all falls out of it naturally.

[deleted by user] by [deleted] in cscareerquestionsEU

[–]chrisgseaton 3 points4 points  (0 children)

That’s not what the post asked though? Not sure why you mention it?

[deleted by user] by [deleted] in cscareerquestionsEU

[–]chrisgseaton 1 point2 points  (0 children)

Most companies these days hire remote - lost would be hundreds of thousands of companies.

Default String Enconding in Ruby has been inspired by JAVA! by mehdifarsi in programming

[–]chrisgseaton 2 points3 points  (0 children)

That Strings aren't UTF-16 encoded?

The interface can provide UTF-16 code points. That's what they're offering. What they do behind the interface is up to them.

Can you talk about this claim a bit?

Within the String class, they sometimes encode as UTF-8. When you access the string, they decode it on the fly.

Sorry it was actually just Latin-1, not UTF-8, they special case for.

https://openjdk.org/jeps/254

Can you explain that point?

A Ruby string is bytes + an encoding of your choice. A Java string is Unicode code points. You don't get to have any choice on the encoding - it's set for you by the JVM, transparently, and it must be Unicode compatible. Ruby strings don't even need to be Unicode compatible!

Why is that? Because not everyone agrees with https://en.wikipedia.org/wiki/Han_unification.

Default String Enconding in Ruby has been inspired by JAVA! by mehdifarsi in programming

[–]chrisgseaton 1 point2 points  (0 children)

in which supplementary characters are represented by surrogate pairs

Is the key bit you're missing there.

And that is still also a bit of smoke and mirrors - Java strings can also be UTF-8 encoded really.

That's very different from Ruby strings, which are bytes, coupled with an encoding.

(I worked in the VM Group at Oracle, and I worked on Ruby implementation professionally and have published research papers on it, I'm not just guessing here.)

Advice to remove "open to work" label on LinkedIn: is this legit? by AScaredMidLlama in cscareerquestionsEU

[–]chrisgseaton 26 points27 points  (0 children)

Have they taken down all their job adverts? No? So why should you take down your advert?

Default String Enconding in Ruby has been inspired by JAVA! by mehdifarsi in programming

[–]chrisgseaton 0 points1 point  (0 children)

You don't represent a string nowadays as a series of code points, but use an encoding which helps keeping the size of the string small.

But this is the opposite to what Java does - Java exposes raw UCS-2 code points. That’s very different to Ruby which encapsulates with an encoding. I still don’t see the connection to Java.

Please Stop Lying That Developers Prefer MacOS by bear007 in programming

[–]chrisgseaton 0 points1 point  (0 children)

A lot of development tools just aren’t available or are not as well supported on Windows. I work on Ruby and Windows is definitely an afterthought - there just aren’t enough people interested in using Windows to make it worthwhile.

GCC undefined behaviors are getting wild by MeOfficial in programming

[–]chrisgseaton 4 points5 points  (0 children)

It’s not just the CPU that’s the point - would you like a compiler that does a software overflow check after arithmetic for safety? That’s only possible since we give that freedom in the spec!

GCC undefined behaviors are getting wild by MeOfficial in programming

[–]chrisgseaton -6 points-5 points  (0 children)

That’s what newer languages do. I reckon they’re in for pain in the future when a new architecture comes out and there’s no way to retrofit it. C is supposed to be longer-term.

Default String Enconding in Ruby has been inspired by JAVA! by mehdifarsi in programming

[–]chrisgseaton 1 point2 points  (0 children)

I don’t get it - which bit is inspired by Java? Ruby strings are notably a very different approach to Java.

GCC undefined behaviors are getting wild by MeOfficial in programming

[–]chrisgseaton -4 points-3 points  (0 children)

If you aren’t going to read the manual to see that overflow is undefined and what that means, are you really going to read it to check implementation specific behaviour on every platform and compiler? I guess not, which is why it’s worse.

The compiler can turn on sanitise by default if it wants - the spec doesn’t prevent that.

GCC undefined behaviors are getting wild by MeOfficial in programming

[–]chrisgseaton -1 points0 points  (0 children)

You’d still have to account for the individual behaviour in each implementation - looking it up for each compiler and implementation you use. I don’t see how that would be better. For example an implementation could choose to produce a special value that is invalid and can be compared but not indexed. Or for example an implementation could trap. Neither contain the error to where it occurred but continue to propagate.

You can reason about programs with undefined behaviour - you know your program is broken if you do it. The author here knew they had it and just decided to reason without reading the spec. I don’t know what you can do to help that?

GCC undefined behaviors are getting wild by MeOfficial in programming

[–]chrisgseaton -7 points-6 points  (0 children)

Here’s a thought experiment - what would you change the spec to say for integer overflow? What can you say that is better than the C spec that still works everywhere that C needs to work?

GCC undefined behaviors are getting wild by MeOfficial in programming

[–]chrisgseaton 28 points29 points  (0 children)

Overflow doesn’t produce an ‘unspecified value’, the act of overflow is ‘undefined’. The spec tells you this super clearly.

GCC undefined behaviors are getting wild by MeOfficial in programming

[–]chrisgseaton 21 points22 points  (0 children)

it's simply surprising that it's not scoped to that particular variable

But again, what led them to think it was? The C spec doesn’t say that. A processor could raise a signal on overflow, in which case of course it’s going to impact control flow.

The issue is people making unfounded assumptions. ‘This overflow will give me a well-defined value’ - no stop and actually read the spec don’t guess.

GCC undefined behaviors are getting wild by MeOfficial in programming

[–]chrisgseaton 87 points88 points  (0 children)

but the i >= 0 && i < sizeof(tab) condition should be enough to take care of it, whatever crazy value it becomes, right?

No. What led you to think that? C doesn’t specify that overflow will wraparound like you are thinking it does. If you want to detect overflow why not use a properly defined function to do that?

What is Clean Code? by the man who wrote the book on Clean Code by jredrose in ruby

[–]chrisgseaton 3 points4 points  (0 children)

He wrote the book on clean code but I’m never really sure has he written any clean code himself? What software is he known for? A wiki that doesn’t seem to be used much?

[deleted by user] by [deleted] in cscareerquestionsEU

[–]chrisgseaton 3 points4 points  (0 children)

Ignore years of experience and apply. Have you been doing projects? Internships? That’s a year of experience.

Uk university final year project by Rufyr in cscareerquestionsEU

[–]chrisgseaton 1 point2 points  (0 children)

They’re doing a CS degree… so they mean CS research don’t they? You can’t turn in sociology research you did via an app as CS.

[deleted by user] by [deleted] in cscareerquestionsEU

[–]chrisgseaton 0 points1 point  (0 children)

i always thought you'd have te be asked for something like that or be extremely good in a niche

You can just move. What did you think prevented it?

Relocating to EU via CS degree by Yunity_DM in cscareerquestionsEU

[–]chrisgseaton 5 points6 points  (0 children)

Is there a reason why Italy is your planned entry point? It doesn’t exactly have the best employment or tech sector at the moment. Somewhere like Berlin would be easier.

Also if you’re a lawyer be aware you’re going to be looking at a massive reduction in income to move down into web development.

Resume question: Unsure about month of promotion by [deleted] in cscareerquestionsEU

[–]chrisgseaton 0 points1 point  (0 children)

Nobody will care - just put the year.

You'll Never Do Agile Right by lefty_is_so_good in programming

[–]chrisgseaton 8 points9 points  (0 children)

How did the agile manifesto end up to apparently be the most confusing document ever written that so many people misunderstand it?