# Why are format strings showing blank values

**URL:** <https://forums.sifive.com/t/why-are-format-strings-showing-blank-values/6096>\
**Category:** HiFive1 Rev B\
**Created:** [April 6, 2023, 12:44am UTC](https://forums.sifive.com/t/why-are-format-strings-showing-blank-values/6096 "2023-04-06T00:44:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomh](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@tomh](https://forums.sifive.com/u/tomh)\
**Post date:** [April 6, 2023, 12:44am UTC](https://forums.sifive.com/t/why-are-format-strings-showing-blank-values/6096/1 "2023-04-06T00:44:09Z")

</div>

I am trying to print some values to stdout calling a “dump” function (part of a library I have made which gets linked at compile time)

```auto
void dump(tensor *t, int asfloat) {
  for (int j = 0; j < t->data_len; j++) {
    uint8_t d = ((uint8_t *)t->data)[j];
    printf("%x, ", d);
  }
}

```

Result:

```auto
, , , , , , , , , ,

```

Is this something to do with privilege level? Can I just run everything at maximum privilege for my tests?

---

<div class="post-metadata">

**Author:** ![pds](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pds](https://forums.sifive.com/u/pds)\
**Post date:** [April 6, 2023, 2:50am UTC](https://forums.sifive.com/t/why-are-format-strings-showing-blank-values/6096/2 "2023-04-06T02:50:03Z")

</div>

The parentheses look a little strange to me; maybe try something like below? Also, declaring all variables first (at function scope) usually helps the compiler, a lot.

```auto
void dump(tensor *t, int asfloat) {
  uint8_t d;
  for (int j = 0; j < t->data_len; j++) {
    d = (uint8_t) ((t->data)[j]);
    printf("%x, ", d);
  }
}

```

You may also want to check the .lst file output to see exactly what is the code being generated; if not as desired, there might be a compiler option or optimization level that could help.

Nothing here nas anything to do with privilege level though, which is good.

---

<div class="post-metadata">

**Author:** ![jrtc27](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/jrtc27/32/1352_2.png) [@jrtc27](https://forums.sifive.com/u/jrtc27)\
**Post date:** [April 6, 2023, 7:15pm UTC](https://forums.sifive.com/t/why-are-format-strings-showing-blank-values/6096/3 "2023-04-06T19:15:01Z")

</div>

> [@pds](#):
>
> The parentheses look a little strange to me; maybe try something like below?

Moving the parentheses changes the semantics in ways that may not be the original intent, depends what data\_len is.

> [@pds](#):
>
> Also, declaring all variables first (at function scope) usually helps the compiler, a lot.

No it doesn’t.
