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 » U++ Library support » U++ Core » [XML] Assertion when GetAttrCount()
Re: [XML] Assertion when GetAttrCount() [message #6934 is a reply to message #6906] Tue, 05 December 2006 13:12 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
g00fy wrote on Mon, 04 December 2006 02:29

#include <CtrlLib/CtrlLib.h>
#include <ide/Common/Common.h>
#include <Core/Core.h>




U++ headers are always arranged so that "higher" include "lower", means "#include <ide/Common/Common.h>" is enough here.

Quote:


This code asserts on the call to "xml.GetAttrCount()". It thinks the vector holding those items have -1 items only...



-1 in items is generally the sign of broken pick semantics. Indeed:

	XmlNode makefile = xml.Add("makefile");
	
	XmlNode lib = makefile.Add("lib");


Here you pick "makefile" node out of xml and "lib" out of makefile. This is basically "java style code"...

In U++ we are usually referencing objects created inside complex structures:

	XmlNode& makefile = xml.Add("makefile");
	
	XmlNode& lib = makefile.Add("lib");


These are basic paradigms of U++ - perhaps unusual for newcomers, but in the end this is a way how to keep things simple and deterministic (and avoid smart pointers and GC wishes...)

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bug in "Streams" documentation (Serialization support)?
Next Topic: Value: BOOLEAN_V, USERVALUE_V [REQUEST]
Goto Forum:
  


Current Time: Sun Aug 17 20:34:24 CEST 2025

Total time taken to generate the page: 0.04626 seconds