Recent Posts

Pages: 1 ... 7 8 [9] 10
81
Implementation Details / CTC (partial, full, none)
« Last post by lerno on December 01, 2018, 05:34:50 PM »
I'd like some clarification on how this one works and what the expectation is for each state.
82
Ideas / Typeinfo at runtime
« Last post by lerno on December 01, 2018, 10:59:10 AM »
I want to suggest that type info should be available at runtime. There are various way to implement this. In the end, the type should only be reduced to a number that’s used to access a generated a set of functions that are built during code generation.

To do this we need to introduce another built in type, ”vtype”.

Code: [Select]
vtype x = typeof(a);
bool y = is_struct(x);

What’s interesting here is for scripting and very dynamic plugins.
A function may take a void* plus the vtype and work on the data as if it was the given type, even though the code was built BEFORE the type was written.

The most general use for this is to dump structure data for debugging.
The macro can then be something like:

Code: [Select]
#define DUMP(x) dump_data(typeof(x), (void*)&x)

(Very rough, but hopefully you see what I mean)

dump_data here is a FUNCTION not a macro.

This is just a discussion starter. Add to the idea!
83
Ideas / Re: Switch proposal
« Last post by lerno on November 30, 2018, 06:39:23 PM »
Err... My proposal was to add implicit break.
84
General Discussion / Re: Overwriting fields in init struct.
« Last post by lerno on November 30, 2018, 06:37:46 PM »
Motivation why it should be allowed is in the first post...
85
Implementation Details / Re: Suppress warnings
« Last post by lerno on November 30, 2018, 06:36:53 PM »
For file maybe. I find that I mostly will turn of statement based warnings. It's when I run into a piece of code I know will be safe, but that the compiler think might be unsafe. In java that's usually casting between generics. For Objective-C, using dynamic calls where the compiler can't see the definition, etc. Things that you want to avoid 90% of the cases.
86
Implementation Details / Re: Code formatting of C2's c++
« Last post by lerno on November 30, 2018, 06:33:38 PM »
Oh, it's not about stupidity, it's about grammar ambiguity.
87
Implementation Details / Re: LLVM/C gen
« Last post by lerno on November 30, 2018, 06:32:45 PM »
I don't know. I've looked at IR gen by other languages and it seems they don't have it. It might me that they are not yet heavily invested in debugging. I don't know.
88
Ideas / Re: Switch proposal
« Last post by bas on November 30, 2018, 05:03:55 PM »
Fallthrough is always automatic, except when you use break. So there is never an automatic break.
The compiler gives gives a warning/error if you don't use break/fallthrough in cases there is a code..
89
Ideas / Re: Support of Unicode ?
« Last post by bas on November 30, 2018, 01:42:52 PM »
In all my years of programming, I've only had to do I18n twice. Both were C++ projects. In C never. In C a basic string is just a char* with 8-bit characters. That
works for 99.9% of the cases. What would be nice if we could add special Strings as an optional feature. If not used, no overhead etc.
90
General Discussion / Re: Overwriting fields in init struct.
« Last post by bas on November 30, 2018, 01:19:43 PM »
Why would this not be an error?
Pages: 1 ... 7 8 [9] 10