This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Heiko, > while working with the perl-udunits2 package, I recognized the following; > > • ut_free_system: segmentation-fault when freeing same system* twice That's not a bug. It's like passing a pointer to the function free() twice, resulting in undefined behavior. The description of the ut_free_function() says this: Use of [the pointer argument] after this function returns results in undefined behavior. The documentation of the free() function says something similar. You should modify your code so that it calls ut_free_system() only once for each pointer. Alternatively, set the value of the pointer to NULL upon return from the ut_free_system() function. > • several errors in definition files, e.g. Definition of "microns" in > "/home/heikok/Programme/Perl/Udunits/share/udunits2-common.xml", line > 296, overrides prefixed-unit "1e-15 second" Those messages are warnings: they don't indicate an error. Before the parser encountered the "micron" unit, it would have parsed the string "microns" as "micro nanoseconds" or "1e-15 seconds". The parser is letting you know that this will no longer happen. You can disable these warning messages via the function ut_handle_error_message() if you wish. > • chapter 5 in c-api doc (ut_parse) should be merged with 3.2 (ut_get_unit*) I wondered about that. The ut_parse() and ut_get_unit() functions are different, however. The ut_parse() function accepts arbitrary string unit specifications, which includes prefixes and mathematical operations; whereas, the ut_get_unit() function requires a simple, single unit specification -- no prefixes or operations allowed. Maybe I should switch chapters 4 and 5 so that the chapter on parsing an arbitrary unit specification would follow the chapter on getting a particular unit from a unit system. What do you think? > Heiko Regards, Steve Emmerson Ticket Details =================== Ticket ID: MGE-245661 Department: Support UDUNITS Priority: Normal Status: Closed