News for hackers. Stuff that matters.
Re:C is Lower Level Than You Think by Nursie on Tuesday November 26, 2013 @03:16AM (#6799857)
No, C is lower level than you think.

That's perfectly rational behaviour. And yes, the string could change mid iteration, in the loop or in another function that has access to the address, or even in another thread that's just made a guess at a valid memory address.

This is the beauty and power of C, everything is a piece of memory and nothing is guaranteed, and no we will not hold your hand or stop you doing something stupid. Someone else has a valid use case for that, even if they don't know it yet.

Re:C is Lower Level Than You Think by coldtea on Tuesday November 26, 2013 @03:48AM (#6800002)
>No, C is lower level than you think.

Really? What made you think he doesn't think at the correct level? The fact that he tried to correct others that invoke the "sufficiently advanced compiler" thing?

If anything that would be proof that he thinks at the RIGHT level.

>And yes, the string could change mid iteration, in the loop or in another function that has access to the address, or even in another thread that's just made a guess at a valid memory address.

He already stated all that -- not to mention he knows it for over 3 decades.

>That's perfectly rational behaviour.

He didn't say it wasn't. He merely said that counter to some people who invoke the "sufficiently advance compiler" idea, that's what is actually happening.

Re:C is Lower Level Than You Think by sgift on Tuesday November 26, 2013 @03:38AM (#6799960)
> This is the beauty and power of C, everything is a piece of memory and nothing is guaranteed, and no we will not hold your hand or stop you doing something stupid. Someone else has a valid use case for that, even if they don't know it yet.

Just replace C with assembler and we know why we should all go back to it. Or rather not ..? Guarantees provide reliable environments. Reliablity is really helpful.

My nitpick aside ... I still want to (finally, really) learn C some time. Yeah, I can read it more or less, but that's not the same. Maybe on my next vacation.

Re:C is Lower Level Than You Think by Crito on Tuesday November 26, 2013 @03:48AM (#6800006)
Going back to assembly has it's place, sometimes you want to do some gnarly/neat stuff with the call stack which is straightforward in assembly but which C doesn't lend itself to. Other times, you don't need to do that, and C has you covered. Yet other times, you really don't need to do anything that C enables and python will have you covered instead... it all depends on what you are doing.
Re:C is Lower Level Than You Think by goldenkey on Tuesday November 26, 2013 @03:50AM (#6800016)
Inline assembly in C, but still you don't need to jump to pure assembly (ie FASM/MASM/TASM,etc.). OP is just mouthing off about how if you go one level deep, you might as well strip off all your floorboards. Thats a logical fallacy.
Re:C is Lower Level Than You Think by mcv on Tuesday November 26, 2013 @04:03AM (#6800060)
C is basically readable, portable assembler. That's it. Don't treat it as a high level language; treat it as a nicer alternative to assembler. It definitely has its place, but it's not for everybody.
Re:C is Lower Level Than You Think by goldenkey on Tuesday November 26, 2013 @03:44AM (#6799989)
I really don't think you have a space to speak here if you don't know C. C is a behemoth, sure but there's no surprises. And assembler is platform specific, so you can't really make the 'bandwagon'/'slippery slope' logical fallacy. Stay in Python/Ruby/TLC world, and leave us hard-core coders alone. We'll continue making the performant libs that your dynamic language runtime requires. Thanks.
Re:C is Lower Level Than You Think by sgift on Tuesday November 26, 2013 @06:25AM (#6800476)
Much real world C code is platform specific too. As written: I can read C (more or less) and I can recognize things like code that will only work on your nice little endian platform and will explode in your face on big endian. Code like that is written all the time in C - especially by programmers that "continue making the performant libs" or whatever you think you do. So, the abstraction over assembler is often far smaller than you make it out to be. But that is a completely different point, which has nothing to do with my last post.
Re:C is Lower Level Than You Think by goldenkey on Tuesday November 26, 2013 @12:16PM (#6802631)
sgift, dealing with big vs small endian is a ways away from dealing with different opcodes and instruction sets like SSE and whatnot. It's not far smaller. It's huge. You aren't speaking from experience. As someone who used to do reverse engineering and knows assembly first-hand, I'm not going to argue with you about the different between writing code in assembly versus C. You're incorrect to say that ASM and C are so close. There's a reason why certain routines are implemented in CPU architecture specific asm, and that's for speed. Because C is still too high up to make many optimizations. The lack of fine-grained-ness is definitely there, in regard to the processor instructions used.
Re:C is Lower Level Than You Think by Nursie on Tuesday November 26, 2013 @04:28AM (#6800127)
I never said we should all use C for everything, I certainly don't :)

But it is what it is, a thing of great power and beauty but highly dangerous in the wrong hands.

Re:C is Lower Level Than You Think by joshguthrie on Tuesday November 26, 2013 @03:10PM (#6803837)
> we will not hold your hand or stop you doing something stupid

Thanks for underlining exactly why I love C: no bullshit, get down in the dirt, eat your debugging, live with valgrind for that tiny bit that won't free itself,... Sometimes, I wish ruby could segfault a bit just so I have to debug my code for something else than a missing '='...

Re:C is Lower Level Than You Think by greenlakejake on Tuesday November 26, 2013 @05:09AM (#6800247)
I agree. The OP's examples are lame. Anyone who has written a memory allocator (I've written at least a couple) knows there's overhead for each allocation.

There are many ways you can shoot yourself in the foot with C that are much more obscure.