Initialise aggregate with include directive
Very quick question. I want to copy & paste textual data into the source code 开发者_运维知识库from the separate file using include directive.
Is it legal?
struct Record; // collection of data fields
Record rec = { #include "some_big_record.txt" };
int numbers[] = { #include "some_long_sequence_of_numbers.txt" };
It works on my box (GCC), but is it portable?
This is portable:
Record rec = {
#include "some_big_record.txt"
};
精彩评论