GCC Option For Permitting Undeclared Variables

A

Alfred

On Ubuntu, I've been experimenting with Kazuho Oku's fascinating Linux-
based perl/C trick to implement C and C++ as a scripting language...

http://labs.cybozu.co.jp/blog/kazuhoatwork/my_projects/c/C
http://labs.cybozu.co.jp/blog/kazuho/archives/c/C-0.05-1.i386.rpm

The question I have for any Linux C++ programmer out there is, if I
implement a Variant class data type, and use that for all my variables
(because it's meant for short scripts), then is there also a GCC
option or trick in C++ where all undeclared variables are assumed to
be this Variant data type?

(For a scripting language, I find the declarations of data types to be
tedious. However, when using C and C++ as a full-blown, compiled
language for doing big things like serious stuff, then yeah, I'm aware
that the variant and undeclared variable things are not a really good
idea. I'm just looking for something here for an incredibly fast
scripting language. Oku's technique can help one write a script that
is 100x faster than Perl on the Fibonacci test.)
 
J

John Harrison

Alfred said:
The question I have for any Linux C++ programmer out there is, if I
implement a Variant class data type, and use that for all my variables
(because it's meant for short scripts), then is there also a GCC
option or trick in C++ where all undeclared variables are assumed to
be this Variant data type?

No.
 
C

Clark S. Cox III

Alfred said:
On Ubuntu, I've been experimenting with Kazuho Oku's fascinating Linux-
based perl/C trick to implement C and C++ as a scripting language...

http://labs.cybozu.co.jp/blog/kazuhoatwork/my_projects/c/C
http://labs.cybozu.co.jp/blog/kazuho/archives/c/C-0.05-1.i386.rpm

The question I have for any Linux C++ programmer out there is, if I
implement a Variant class data type, and use that for all my variables
(because it's meant for short scripts), then is there also a GCC
option or trick in C++ where all undeclared variables are assumed to
be this Variant data type?

No. There is no way, in C++, to make any use of undeclared variables.
 
G

Grizlyk

Alfred said:
The question I have for any Linux C++ programmer out there is, if I
implement a Variant class data type, and use that for all my variables
(because it's meant for short scripts), then is there also a GCC
option or trick in C++ where all undeclared variables are assumed to
be this Variant data type?

Write here a short piece of C++ code to show what do you want.
 
A

Alfred

Write here a short piece of C++ code to show what do you want.

Backing up a bit...You know what I really want? I really want to take
the open source 'ngs-js' package on Linux, get the source code, fork
it, learn it, and make it into something else entirely. Or, I want to
find some fast track way to learn lex and yacc to make a Javascript-
like language of my own. But it's all very hard to understand. And I
have to keep asking myself -- here we are in the new millenium, and we
can do so much with computers, but why is it so hard still to develop
a common language runtime and have a way for programmers to create
scripting languages for that with far less effort? I've seen Parrot,
and that's a great step in the right direction, but I still can't
understand how to use it and I wonder if the whole Parrot project is
just dead.

Anyway, I'm going all over the place here -- it's very late and I've
been soapboxing too much.
 
G

Grizlyk

Alfred said:
Backing up a bit...

What does it mean?
You know what I really want? I really want to take
the open source 'ngs-js' package on Linux, get the source code, fork
it, learn it, and make it into something else entirely. Or, I want to
find some fast track way to learn lex and yacc to make a Javascript-
like language of my own. But it's all very hard to understand.

No, I have asked not about your plans of life, i asked, what C++ code do you
want to write with undeclared variables and what advantages does undeclared
status of variables give to you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top