Click here to Skip to main content
14,930,487 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

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.
 
GeneralRe: Bayesian stats & a Q Pin
raddevus17-Dec-20 4:22
mvaraddevus17-Dec-20 4:22 
GeneralRe: Bayesian stats & a Q Pin
PhilipOakley17-Dec-20 4:24
professionalPhilipOakley17-Dec-20 4:24 
GeneralThought of the Day Pin
OriginalGriff16-Dec-20 4:57
mveOriginalGriff16-Dec-20 4:57 
GeneralRe: Thought of the Day Pin
W Balboos, GHB16-Dec-20 5:24
mveW Balboos, GHB16-Dec-20 5:24 
GeneralI'm clever this morning Pin
honey the codewitch16-Dec-20 4:47
mvahoney the codewitch16-Dec-20 4:47 
GeneralRe: I'm clever this morning Pin
PIEBALDconsult16-Dec-20 5:24
professionalPIEBALDconsult16-Dec-20 5:24 
GeneralRe: I'm clever this morning Pin
Rick York16-Dec-20 5:30
mveRick York16-Dec-20 5:30 
GeneralRe: I'm clever this morning Pin
trønderen16-Dec-20 5:57
Membertrønderen16-Dec-20 5:57 
Isn't that how any language implemented variable length strings before C arrived and "invented" NUL termination? (In conflict with long established international standards... If you really need a string terminator character, there is one in the ASCII / ISO646 character set; it is not NUL!)

For something like forty years, the common way of serializing mixed type data has been to take it one step further, adding a (binary) tag prefix, for a TLV (tag - length - value) format. Skipping through the fields of an unordered record is simple and quick.

One disadvantage is that if you run on a 64 bit CPU, and insist on 64 bit tag and length, then you have a 16 byte overhead per value. There are standards for packing both tag and length, not unlike UTF-8 encoding, so that a "small" tag and short length take up only one byte each - at the expense of more complex code when the small tag or length range is exceeded.

And, talking about NUL terminators: One standard way to terminate list of a variable number of fields (including a variable length array) is by a sentinel element of tag = 0, length = 0. If you want super-efficient code and use a packed format, one byte for each, you can test both as a single short to see if it is zero, in single instruction.
GeneralRe: I'm clever this morning Pin
Jörgen Andersson16-Dec-20 6:36
professionalJörgen Andersson16-Dec-20 6:36 
GeneralPythagorean Theorem Day today Pin
Amarnath S16-Dec-20 4:32
professionalAmarnath S16-Dec-20 4:32 
GeneralRe: Pythagorean Theorem Day today Pin
W Balboos, GHB16-Dec-20 4:47
mveW Balboos, GHB16-Dec-20 4:47 
GeneralRe: Pythagorean Theorem Day today Pin
CodeWraith16-Dec-20 6:41
MemberCodeWraith16-Dec-20 6:41 
GeneralRe: Pythagorean Theorem Day today Pin
Slacker00716-Dec-20 8:00
professionalSlacker00716-Dec-20 8:00 
GeneralRe: Pythagorean Theorem Day today Pin
CodeWraith16-Dec-20 8:09
MemberCodeWraith16-Dec-20 8:09 
GeneralRe: Pythagorean Theorem Day today Pin
trønderen16-Dec-20 14:57
Membertrønderen16-Dec-20 14:57 
GeneralRe: Pythagorean Theorem Day today Pin
DRHuff16-Dec-20 7:26
MemberDRHuff16-Dec-20 7:26 
GeneralRe: Pythagorean Theorem Day today Pin
BabyYoda16-Dec-20 8:25
MemberBabyYoda16-Dec-20 8:25 
GeneralRe: Pythagorean Theorem Day today Pin
jeron116-Dec-20 8:40
Memberjeron116-Dec-20 8:40 
GeneralRe: Pythagorean Theorem Day today Pin
  Forogar  16-Dec-20 9:24
professional  Forogar  16-Dec-20 9:24 
GeneralRe: Pythagorean Theorem Day today Pin
Rich Leyshon16-Dec-20 21:54
MemberRich Leyshon16-Dec-20 21:54 
GeneralCame Across This Pin
W Balboos, GHB16-Dec-20 3:55
mveW Balboos, GHB16-Dec-20 3:55 
GeneralRe: Came Across This Pin
Rick York16-Dec-20 5:34
mveRick York16-Dec-20 5:34 
GeneralRe: Came Across This Pin
W Balboos, GHB16-Dec-20 5:47
mveW Balboos, GHB16-Dec-20 5:47 
GeneralRe: Came Across This Pin
trønderen16-Dec-20 6:36
Membertrønderen16-Dec-20 6:36 
GeneralRe: Came Across This Pin
W Balboos, GHB16-Dec-20 6:44
mveW Balboos, GHB16-Dec-20 6:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.