|
CPallini wrote: Now goto is on the way! And then C++
|
|
|
|
|
Please! Let's not go backwards!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Is the guy using structs by any chance ?
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
I have no code to work from, but he says that all "local variables" have been moved to a class to reduce stack usage. I've mentioned large value types as parameters, but ... no code, so guesswork is the order of the day here - and gathering information, obviously!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: Please! Let's not go backwards! .++C neht dnA
|
|
|
|
|
Not sure if this helps, but I use StackTrace and StackFrameData as discussed here[^] in production code, no pointers required.
|
|
|
|
|
This is also what I do, though the local is declared in a Thread::Start function that invokes the subclass' Enter function after saving the pointer in per-thread data. The pointer is then used to monitor stack usage and stop a stack overflow before it occurs.
|
|
|
|
|
Does it work in release versions?
I'd have thought an intelligent compiler would throw it's hands up in horror and optimize it into a register, then optimize the method into oblivion.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
The item to which a pointer is obtained is declared as a local in a function that remains on the stack, and the pointer to it is saved in per-thread data (the equivalent of thread_local ). So yes, it works in a release build. But this is also C++, and I disable some optimizations so that a release build can actually be debugged.
|
|
|
|
|
They can be quite useful - for example, if you want to get the bytes out of a SecureString[^] without going via a string .
public static byte[] GetBytes(this Encoding encoding, SecureString value)
{
if (encoding is null) throw new ArgumentNullException(nameof(encoding));
if (value is null || value.Length == 0) return Array.Empty<byte>();
IntPtr valuePtr = IntPtr.Zero;
try
{
valuePtr = Marshal.SecureStringToGlobalAllocUnicode(value);
if (valuePtr == IntPtr.Zero) return Array.Empty<byte>();
unsafe
{
char* chars = (char*)valuePtr;
int byteCount = encoding.GetByteCount(chars, value.Length);
var result = new byte[byteCount];
fixed (byte* bytes = result)
{
encoding.GetBytes(chars, value.Length, bytes, byteCount);
}
return result;
}
}
finally
{
if (valuePtr != IntPtr.Zero)
{
Marshal.ZeroFreeGlobalAllocUnicode(valuePtr);
}
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Timothy confused, initially, by 0 BYTES FREE (3, 4, 11)
_______________________
Sorry about the very late solution here folks, life gets in the way sometimes!
TOO MUCH INFORMATION
Timothy = Tim
confused (anag. indicator) = TMI
initially = abbreviation / initials
TMI = Too Much Information
0 bytes free = Too much information :-D The point of using the VAR formatting was simply to emphasise that yes, the message was to be taken literally.
I'd quite liked the "0 bytes free" = "too much information" idea anyway, then last week someone replied to Griff's comment that he was off for a wee with "TMI = Too much information" and the die was cast... S'pose I need to think of something else for tomorrow now. Advance warning - I'm out from 09:30 and not back to 16:30, and being on duty can't access emails!
modified 12-May-21 11:54am.
|
|
|
|
|
I suspect you will be up again tomorrow Derek - I'm nowhere with this one.
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
Likewise.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
And there was I, thinking embarrassingly trivial... (and no, that's not a clue).
|
|
|
|
|
So what was it? I've still no idea at all, but suspect my head / desk interface is about to get a bashing.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
NOTE - I may be late posting confirmation / answer as out of contact for a few hours now; but will review on my return!
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
I have no clue either. Initially suggests taking initial letters, or maybe Tim from Timothy. Confused suggests an anagram. 0 could expand to zero. Free is the likely definition, but how do you reach 18 letters with two indicators? timothybyzerobytes is 18 letters, but then what is initially doing in there? It's also poor fodder for an anagram.
|
|
|
|
|
And what is the red bit for?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Careful Griff... desks are expensive!
|
|
|
|
|
Your spanking will be brutal.
|
|
|
|
|
It was her who named the company, declaring "It's Micro and Soft."
|
|
|
|
|
Actually she said "My crow is in the loft", and being hard hearing Bill misunderstood that as "Microsoft".
|
|
|
|
|
Wow. I'm amazed you didn't pen "M$". Talk about the bias of two decades (while loosing).
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
That joke is older than the hills, and wasn't funny the first time I heard it.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Especially given that the company got its name in the mid-70s...and Melinda never had a conversation with Bill until well over a decade later.
|
|
|
|