Reputation: 6493
I found the construct = {0};
in this C-code sample, found on tidy.sourceforge.net
What is the rvalue of the statement and is it ANSI C?
#include <tidy.h>
#include <buffio.h>
#include <stdio.h>
#include <errno.h>
int main(int argc, char **argv )
{
const char* input = "<title>Foo</title><p>Foo!";
TidyBuffer output = {0};
TidyBuffer errbuf = {0};
Upvotes: 2
Views: 431
Reputation: 6529
This initializes all fields in a struct, in your case TidyBuffer
, to zeroes. The rule in C is that you can omit members in an initialization clause, and the rest will be initialized to zero. In C++, this is legal as well:
TidyBuffer output = {};
Upvotes: 5