Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » U++ community news and announcements » Invalid Value conversions now throws (instead of undefined behaviour)
Invalid Value conversions now throws (instead of undefined behaviour) [message #42877] Sat, 12 April 2014 19:41
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
So far, trying to convert Value to incompatible type failed ASSERT in debug and was undefined in release.

This was fine for a long time, but e.g. with JSON parsed into Value, it is sort of more problematic, as then in theory all Values should have been tested for the right type before assigning them (as you cannot never trust external .json data to provide correct types).

That is why from now, invalid conversion results in exception ValueTypeError and we can now safely write:

try {
Value v = ParseJSON(...);
String h = v["foo"];
}
catch(ValueTypeError) {
// JSON is invalid
}

Mirek

[Updated on: Sat, 12 April 2014 19:45]

Report message to a moderator

Previous Topic: Development blog canceled, topics moved to "news"
Next Topic: CParser::ReadString inverted default for 'unterminated string' checks
Goto Forum:
  


Current Time: Fri Apr 19 17:23:16 CEST 2024

Total time taken to generate the page: 0.02331 seconds