The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
oops just seeing it's not there natively. (Not sure why)
Union seems to me more or less meaningless in managed code. At least it it contrary to the philosophy of managed code: You don't have a "memory address" but a handle. The runtime system will interpret that handle, translating it to "some" memory address that you shouldn't care about at all.
The runtime system has the right to to that handle-to-address mapping in whatever way it pleases: It can do a JIT compilation (for code handles) and put the result into the assembly cache, it can load the data object from some backing store (in principle even magnetic tape!) etc.
A union says: Let these two logical objects (usually fields in a class/struct), the two handles, be translated to the same physical address. That would strongly restrict the freedom of the mapping operation of the runtime system. What if the alternative interpretations have different sizes? What if one alternative contains a partial object, addressed through a handle, while another is a flat array? What if one member is an accessor function? Or a delegate? What about a list object unionized with a string? If the semantics of overlaying wasn't unambiguously defined, it would be useless, so you would have to define all the details of cases like these mentiones, and the runtime system would have to imlement exactly that (rather hairy) semantics.
I am really happy that we have kicked unions out the back door.
If you really need that functionality, then you declare a byte array, to hold the "memory block", and define accessors that select parts of that byte array, and by shifting and masking and explicit casting provides other interpretations of the "memory block". It is not done behind the curtain, where the reader would have to know how the compiler and runtime system works on the bit level. Rather, you code it all yourself, explicitly and with a big warnig sign: Danger! Arbitrary, unchecked casts made here! Then you define the overlaying in every detail, completely independent of how the compiler and runtime system treats your data.
Yes, it will cost you a lot of work. It should. To keep you away from doing it.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
Most useful for hardware registers and even software registers. You can view register broadly via the long/int/short or via the fields contained within it. Save a copy:
myCopyReg.bits = mySrcReg.bits. As a bonus your get a copy of the "undefined" bits.
Thank you for this posting.
I am currently working on the conversion of some very old FORTRAN software for the NASA Voyager data processing as we are one of the instrument teams still working the Voyager Interstellar Mission and I have been struggling to find an option in C# to do exactly this, i.e. as mentioned in a reply this is like the FORTRAN COMMON BLOCK statement.
Now I think I will be able to finish my conversion project a lot easier than attempting to write my own version of a COMMON statement and figuring out how to implement all of the various possibilities.
Jerry W. Manweiler, Ph.D.
Fundamental Technologies, LLC
I'm looking for some guidance on best practices for data dictionaries.
I've seen them done poorly (i.e. a dump of sys.columns from the database), sometimes with a brief description but I've never seen them done usefully.
I guess, to provide more context, I'm looking at this more from an analyst perspective, wanting to query a database rather than work with or enhance the application that uses the database.
The sort of thing I think might be useful would be some commentary on when/where a record can change and how. Has anyone seen documentation at this level?
Another way of looking at the question is: If you have found useful data dictionary documentation on a database (either a transaction application or ODS/DW type of DB) then what specifically made it useful? What did it contain?
Also, what systems are around for tracking this - is Word being used - are there more interactive, automated data dictionary systems around that work well. I know some of the ETL tools try in this space - do they work well or are there independent systems you've liked?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
Taking the lead from JSOP Red-Gate do an excellent suite of tools SQL Toolbelt[^]. They are NOT free, quite expensive actually. We have been using some of their stuff for year but not the documentation tool.
Never underestimate the power of human stupidity
Just when a five-meter python had his mouth around kitty, his 63 year-old love slave, Mrs, Saving, and neighbors, and local snake--busters, to the rescue. Note the story is written in a form of mutilated English expats sometimes refer to as "Tainglish:" [^]
Rascal python is getting deported to a far forest where perhaps he'll enjoy backpackers.
«... thank the gods that they have made you superior to those events which they have not placed within your own control, rendered you accountable for that only which is within you own control For what, then, have they made you responsible? For that which is alone in your own power—a right use of things as they appear.» Discourses of Epictetus Book I:12
Google translate isn't being a whole lot of help here:
Mrs. Saving, age 63, the owner of the house heard his cat cats in the back of the house to walk to see that the big boar is eating his own cat. They use a snake bite until the serpent to the wall of the house's mortar by the cats themselves are injured bite the abdomen. Before the rescue team to help.
I think I see what is happening, but ...
Sent from my Amstrad PC 1640 Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!