News for hackers. Stuff that matters.
Re:Rust 1.32 released by SCHiM on Thursday January 17, 2019 @05:46PM (#18935394)
I use this sometimes with some C/C++ code.

Mostly, if I want a break somewhere I do this:

  *(int*)0 = 1;
Which will result in a crash, I attach my debugger, run the code and if it reaches that line it will break and I can inspect everything I want.

It's easier than adding a __asm(int3) because it's cross platform. On windows for example it's not possible to perform inline assembly in x64 builds, and compiler intrinsics are not portable.

Re:Rust 1.32 released by nitrogen on Thursday January 17, 2019 @06:00PM (#18935483)
Have you ever had issues with the compiler removing/ignoring that line when optimizations are turned on?
Re:Rust 1.32 released by SCHiM on Friday January 18, 2019 @04:23AM (#18938086)
No, could it? If I ever noticed it I would make it a bit more complex.
Re:Rust 1.32 released by jcelerier on Friday January 18, 2019 @03:21AM (#18937840)
On windows you can just call DebugBreak();
Re:Rust 1.32 released by SCHiM on Friday January 18, 2019 @04:23AM (#18938090)
Yes, but most of my code is written to be as portable as possible, if not outright cross-platform.
Re:Rust 1.32 released by jcelerier on Friday January 18, 2019 @04:49AM (#18938187)
Using undefined behaviour like this is the opposite of portable.