# cbe: rework StringLiteral to decide between string literal or array initializator syntax · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/54f6e74cda07a1153fd205afc8973665397f6cc7)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 54f6e74cda07a1153fd205afc8973665397f6cc7

Requested commit: 54f6e74cda07a1153fd205afc8973665397f6cc7

Commit: 54f6e74cda07a1153fd205afc8973665397f6cc7

Tree: a65eaa88f52c46740542ea32b07841498b6e136e

Author: kcbanner

Committer: Andrew Kelley

## Message

```
cbe: rework StringLiteral to decide between string literal or array initializator syntax

This fixes an issue with boostrapping the compiler using MSVC. There is a CircularBuffer with
an array of length 65536 initialized to undefined, and because the undefined path of `renderValue`
was using `StringLiteral` to render this, the resulting zig2.c would fail to compile using MSVC.

The solution was to move the already-existing array initializer path (used in the non-undefined path)
into StringLiteral, and make StringLiteral aware of the total length so it could decide between which
style of initialization to use. We prefer to use string literals if we can, as this results in the least
amount of emitted C source.

```

## Parents

- [95cb93944060d04ec49e9d2e21ef911ad2b09ccd](https://git.cafe/gitcafe/zig/commit/95cb93944060d04ec49e9d2e21ef911ad2b09ccd?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/54f6e74cda07a1153fd205afc8973665397f6cc7?format=markdown)
