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 » Newbie corner » [solved]An U++ equivalent of bzero ? (if not a sin) (Can I bzero a flat array of double, or should I use some container template instead?)
[solved]An U++ equivalent of bzero ? (if not a sin) [message #52637] Sat, 02 November 2019 19:34 Go to previous message
xrysf03 is currently offline  xrysf03
Messages: 43
Registered: November 2018
Location: CZ
Member
Dear gentlemen,

while messing with my toy proggie, I've reached a point where I need to initialize an array of "double" (the double-length floating point type) - as an accumulation buffer of sorts.

Defined roughly as

double my_accu_buf[SOME_PARTICULAR_INTEGER_SIZE];


Can I just use the bzero() function that I know from GNU Libc? The MinGW compiler behind U++ cannot find that function, even if I #include <strings.h> . Ahaa, memset() does work (I don't even need to #include <string.h>). It's true that "man bzero" says "nono, deprecated, use memset() instead". Or is there some U++ equivalent? Or, should I refrain from using the unsafe and ugly, plain old C arrays, and use some container template instead? Such as the Vector... And of course I can just iterate across the array, but that feels so *meh* Very Happy

Come to think of that, if I zero-pad the storage allocated behind a "double", do I actually achieve the same as
double my_var = 0;  // ?


Recommendations welcome Smile

Frank

[Updated on: Tue, 12 November 2019 22:18]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [SOLVED] Empty values to the "EditInt" widget and the "int" basic type
Next Topic: Upp::Vector FindIndex by value of Object
Goto Forum:
  


Current Time: Thu Apr 25 23:04:15 CEST 2024

Total time taken to generate the page: 0.03313 seconds