Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 791
pic11 Avatar asked Feb 25 '23 11:02

pic11


1 Answers

This is portable:

Record rec = { 
#include "some_big_record.txt" 
};
like image 88
Erik Avatar answered Mar 03 '23 22:03

Erik