OFF TOPIC:Re: C compiler question (I hope this is on topic)

J

jacob navia

Chad a écrit :
> Given the following...
>
> #include <stdio.h>
>
> int main(void)
> {
> char x;
> x = 5;
>
> return 0;
> }
>
> How does the object know that the value 5 of type char at run time if
> the type is discarded after compile time?

The object doesn't know anything, nor the computer.
Only people can know something, and this, I know:

The compiler takes the text of your program, and translates it into
an equivalent that, when run in an appropiated printed circuit like the
computer that is running in your box, would produce the same effects you
specified in the input program.

In your program you specified:

"Put the value of 5 in a local variable of type char"

char x;
x = 5;

If you take a compiler like lcc-win for instance, you will see that the following instructions are
generated from your program:

.line 4
; 5 char x;
; 6 x = 5;
.line 6
movb $5,-1(%ebp)

The compiler generated a move byte instruction (movb) with the
immediate value of 5 to a memory location at 1 byte less than the value
contained in the frame pointer EBP.

In the prologue of the function, the compiler reserved several
byte locations that can contain the values of the local variables.
The place at -1 (%ebp) is reserved for your character
variable "x".

Then, the compiler generated an instruction that will move 5 into it.

Very simple, and neither the computer, nor the variable, nor anything
"knows" what they are doing, in the same sense that your car doesn't
really know where it is going: it is YOU that knows where YOU are going
and you instruct the car to go there (you "drive" it).

You drive a computer by telling it step by step where it should go. The
computer (like a car) doesn't KNOW anything, and if you tell it to
do nonsense it will do it with the same lack of resistence that your
car will accept that you drive it into a wall without ever complaining
about it.

People have a different kind of circuit than a computer. People know
things, people are even able to build circuits: we are the first circuit
that is able to build circuits. Computers and other circuits that WE build
aren't able to reproduce or do anything without OUR circuit to guide
them, they are MACHINES.

Besides being unable to know something, machines are made out of parts.
You can take your car or your computer apart, then rebuild it, and they
will go on working as before. Our circuit however, can't be taken apart
like that. If you try to take it apart it will stop working and
decompose immediately, instead of working for a few years still as other
circuits that aren't taken apart do.

Still, if you go to the basics of our circuit, the brain, we see that
many of its parts are "machine like". For instance we have an interpreter
called "ribosome", that reads our source code and interprets each codon
into proteins at roughly 50-60 codons per minute. It takes single stranded
source code in one side, and outputs fully folded proteins/enzymes, whatever
that is specified in the source code using 20 building blocks called
amino-acids.

The ribosome is made out of two parts, and if you take them apart and then
rebuild the original ribosome again, the newly built ribosome will go on working
as before, like a machine.

Does the ribosome KNOW what it is doing?

Does the ribosome understand the codons it is interpreting?

Unlikely since it doesn't realize when it introduces an error. If it
misreads a codon and puts the wrong amino-acid in the sequence of the
protein it is building it will produce the wrong output.

In the same vein we have a text editor, for instance. It is BECAUSE
your text editor that you are still alive. Even if the copying mechanism
of your source code is very faithfull, sometimes it does make mistakes

Those mistakes would accumulate if there wasn't for your friend the text
editor that proof reads the copy of the source code and corrects the errors
the copying mechanism introduced.

Does the text editor KNOW the text?

Well, a modern text editor will underscore in red any word that is not
in the dictionary. Somehow our text editor knows about the syntax of
the source code and is able to diagnose a wrong copy, mark it as wrong
and call the repair enzymes to fix the typos.

But then, what is KNOWING???

Does your text editor KNOW english when it says that "ariund" is wrong and
it should be "around" instead?

No. Knowing english would mean that you can WRITE english text and that you
use it to communicate with your peer circuits hanging around in comp.lang.c.

(Even if you aren't very strong in grammar, as you say, I wouldn't doubt that
you KNOW english).

So, to KNOW what it is doing, the text editor would have to produce NEW
source code, i.e. new features of the circuit it is specifying.

But in time frames of millions of years we see that NEW features appear,
without any doubt.

Six million years ago, there wasn't any circuit like the one you have in your
head. It is a COMPLETELY NEW circuit, that nature had NEVER invented till...
well, till 6 million years ago.

Was it the text editor that wrote the new code?

Because there IS new code in our source code. True, we share a lot of source
code with the monkeys and other animals, but there is a tiny but very
significant portion of our source code that is COMPLETELY NEW.

One of the measures of instability of source code is the number of
repeated copies of whole genes.

You know. You are writing a new specialization of some software, you
copy and paste a routine and start hacking around.

Well, "nature" does the same. In species where a rapid evolution is happening,
a LOT of genes are duplicated genes with some modifications, where you can
"see" the hacker writing new code. And, as you would expect, humans are
champions in the number of duplicated genes they have.

Another proof that we are evolving rapidly.

But WHO is writing the NEW code???

The text editor?

Is the text editor rearranging our source code, tinkering with it?

Or is it something ELSE?

WHO KNOWS WHAT IS GOING ON?

How does the character "x" know that it should have 5 as value?

Well, my answer is:

Because the system's driver DESIGNED the system that way for his OWN
purposes that the poor character "x" doesn't have the slightest idea.

Neither the character "x", that exists for a fleeting microsecond
and receives its value to disappear instantly afterwards, (the main program
reaching its last statement right afterwards) nor the computer where it
is running, that will be able to run several billions of similar programs
before he, too, is discarded by the user and thrown away at the
discharge of old computers.

No, neither the character "x" nor the computer know anything. They are
just instantiations of a program, designed by you.

But YOU TOO, you are going to reach your end statement sooner or later,
as you well KNOW, to the contrary of character"x" and his computer home.

And surely, as anything else in the universe the writer of the human program
will ALSO reach its end statement someday... Yes, it will be
probably in a billion years from now, when the aging sun will start
expanding into its red giant phase and will evaporate all oceans of this earth
eliminating all life from its surface.

Then, the writer will disappear, together with its creations.

And the sun too, after its red giant phase, will explode and
disappear from view, leaving a white cinder star, follwoed by
some giant planets, wandering aimlessly in the eternal darkness.

But in a fleeting micro-second THERE WAS a character "x" that
received its value because for a fleeting century there
was a circuit that built circuits because he liked that. And he
liked that maybe because he was programmed to, by the unknown
and invisible hacker that wanted for some unknown purpose in this
world full of ignorance a being that built circuits and asked
himself:

WHAT DO *I* KNOW?

WHERE ARE WE GOING?

WHERE DO WE CAME FROM?


Yours sincerely

jacob
 
S

spinoza1111

Chad a écrit :
 > Given the following...
 >
 > #include <stdio.h>
 >
 > int main(void)
 > {
 >   char x;
 >   x = 5;
 >
 >   return 0;
 > }
 >
 > How does the object know that the value 5 of type char at run time if
 > the type is discarded after compile time?

The object doesn't know anything, nor the computer.
Only people can know something, and this, I know:

The compiler takes the text of your program, and translates it into
an equivalent that, when run in an appropiated printed circuit like the
computer that is running in your box, would produce the same effects you
specified in the input program.

In your program you specified:

"Put the value of 5 in a local variable of type char"

     char x;
     x = 5;

If you take a compiler like lcc-win for instance, you will see that the following instructions are
generated from your program:

         .line   4
;    5   char x;
;    6   x = 5;
         .line   6
         movb    $5,-1(%ebp)

The compiler generated a move byte instruction (movb) with the
immediate value of 5 to a memory location at 1 byte less than the value
contained in the frame pointer EBP.

In the prologue of the function, the compiler reserved several
byte locations that can contain the values of the local variables.
The place at -1 (%ebp) is reserved for your character
variable "x".

Then, the compiler generated an instruction that will move 5 into it.

Very simple, and neither the computer, nor the variable, nor anything
"knows" what they are doing, in the same sense that your car doesn't
really know where it is going: it is YOU that knows where YOU are going
and you instruct the car to go there (you "drive" it).

You drive a computer by telling it step by step where it should go. The
computer (like a car) doesn't KNOW anything, and if you tell it to
do nonsense it will do it with the same lack of resistence that your
car will accept that you drive it into a wall without ever complaining
about it.

People have a different kind of circuit than a computer. People know
things, people are even able to build circuits: we are the first circuit
that is able to build circuits. Computers and other circuits that WE build
aren't able to reproduce or do anything without OUR circuit to guide
them, they are MACHINES.

Besides being unable to know something, machines are made out of parts.
You can take your car or your computer apart, then rebuild it, and they
will go on working as before. Our circuit however, can't be taken apart
like that. If you try to take it apart it will stop working and
decompose immediately, instead of working for a few years still as other
circuits that aren't taken apart do.

Still, if you go to the basics of our circuit, the brain, we see that
many of its parts are "machine like". For instance we have an interpreter
called "ribosome", that reads our source code and interprets each codon
into proteins at roughly 50-60 codons per minute. It takes single stranded
source code in one side, and outputs fully folded proteins/enzymes, whatever
that is specified in the source code using 20 building blocks called
amino-acids.

The ribosome is made out of two parts, and if you take them apart and then
rebuild the original ribosome again, the newly built ribosome will go on working
as before, like a machine.

Does the ribosome KNOW what it is doing?

Does the ribosome understand the codons it is interpreting?

Unlikely since it doesn't realize when it introduces an error. If it
misreads a codon and puts the wrong amino-acid in the sequence of the
protein it is building it will produce the wrong output.

In the same vein we have a text editor, for instance. It is BECAUSE
your text editor that you are still alive. Even if the copying mechanism
of your source code is very faithfull, sometimes it does make mistakes

Those mistakes would accumulate if there wasn't for your friend the text
editor that proof reads the copy of the source code and corrects the errors
the copying mechanism introduced.

Does the text editor KNOW the text?

Well, a modern text editor will underscore in red any word that is not
in the dictionary. Somehow our text editor knows about the syntax of
the source code and is able to diagnose a wrong copy, mark it as wrong
and call the repair enzymes to fix the typos.

But then, what is KNOWING???

Does your text editor KNOW english when it says that "ariund" is wrong and
it should be "around" instead?

No. Knowing english would mean that you can WRITE english text and that you
use it to communicate with your peer circuits hanging around in comp.lang..c.

(Even if you aren't very strong in grammar, as you say, I wouldn't doubt that
you KNOW english).

So, to KNOW what it is doing, the text editor would have to produce NEW
source code, i.e. new features of the circuit it is specifying.

But in time frames of millions of years we see that NEW features appear,
without any doubt.

Six million years ago, there wasn't any circuit like the one you have in your
head. It is a COMPLETELY NEW circuit, that nature had NEVER invented till....
well, till 6 million years ago.

Was it the text editor that wrote the new code?

Because there IS new code in our source code. True, we share a lot of source
code with the monkeys and other animals, but there is a tiny but very
significant portion of our source code that is COMPLETELY NEW.

One of the measures of instability of source code is the number of
repeated copies of whole genes.

You know. You are writing a new specialization of some software, you
copy and paste a routine and start hacking around.

Well, "nature" does the same. In species where a rapid evolution is happening,
a LOT of genes are duplicated genes with some modifications, where you can
"see" the hacker writing new code. And, as you would expect, humans are
champions in the number of duplicated genes they have.

Another proof that we are evolving rapidly.

But WHO is writing the NEW code???

The text editor?

Is the text editor rearranging our source code, tinkering with it?

Or is it something ELSE?

WHO KNOWS WHAT IS GOING ON?

How does the character "x" know that it should have 5 as value?

Well, my answer is:

Because the system's driver DESIGNED the system that way for his OWN
purposes that the poor character "x" doesn't have the slightest idea.

Neither the character "x", that exists for a fleeting microsecond
and receives its value to disappear instantly afterwards, (the main program
reaching its last statement right afterwards) nor the computer where it
is running, that will be able to run several billions of similar programs
before he, too, is discarded by the user and thrown away at the
discharge of old computers.

No, neither the character "x" nor the computer know anything. They are
just instantiations of a program, designed by you.

But YOU TOO, you are going to reach your end statement sooner or later,
as you well KNOW, to the contrary of character"x" and his computer home.

And surely, as anything else in the universe the writer of the human program
will ALSO reach its end statement someday... Yes, it will be
probably in a billion years from now, when the aging sun will start
expanding into its red giant phase and will evaporate all oceans of this earth
eliminating all life from its surface.

Then, the writer will disappear, together with its creations.

And the sun too, after its red giant phase, will explode and
disappear from view, leaving a white cinder star, follwoed by
some giant planets, wandering aimlessly in the eternal darkness.

But in a fleeting micro-second THERE WAS a character "x" that
received its value because for a fleeting century there
was a circuit that built circuits because he liked that. And he
liked that maybe because he was programmed to, by  the unknown
and invisible hacker that wanted for some unknown purpose in this
world full of ignorance a being that built circuits and asked
himself:

WHAT DO *I* KNOW?

WHERE ARE WE GOING?

WHERE DO WE CAME FROM?

Yours sincerely

jacob

Impressive. Another way of looking at it is to use Kant. The type of x
is implicit in the compiled code and not explicit, therefore the
object code doesn't know the type: its "view" of the object is pre-
structured, built in. Likewise, Kant realized that our view of
"reality" is necessarily structured by sense organs. We "see" colors,
but all there "is", are waves and frequencies.

However: there's no reason why a runtime could "know" types and use
them as an interpreter. Each object would be wrapped in type
information.
 
S

spinoza1111

Impressive. Another way of looking at it is to use Kant. The type of x
is implicit in the compiled code and not explicit, therefore the
object code doesn't know the type: its "view" of the object is pre-
structured, built in. Likewise, Kant realized that our view of
"reality" is necessarily structured by sense organs. We "see" colors,
but all there "is", are waves and frequencies.

However: there's no reason why a runtime could "know" types and use
them as an interpreter. Each object would be wrapped in type
information.

We don't anthropomorphise computers. We don't feel any special
affection for them, we don't love them, probably because in principle
we can explain "everything" that goes on modulo random numbers, which
if generated by digital circuits are not really random after all.

The only exogenous factors are human and natural inputs through ports,
such as some babe selecting floating balls shooting out of a column of
air, and entering the winning, and truly random, number into the
computer. Modulo these we should be able to predict what the computer
does and thus we have no love for the computer.

One exception occurs to mind. Computers, such as the Mars rover, which
we send to other planets seem to attract a geeky sort of love when
they are in trouble, especially from geeky females at NASA who are
losing sleep over whether the plucky little device will restart in the
Martian spring. Kubrick had it right: once in outer space, we will
cathect, negatively or positively, with computers.

The end of Terminator II.
 
J

jacob navia

spinoza1111 a écrit :
Impressive. Another way of looking at it is to use Kant. The type of x
is implicit in the compiled code and not explicit, therefore the
object code doesn't know the type: its "view" of the object is pre-
structured, built in. Likewise, Kant realized that our view of
"reality" is necessarily structured by sense organs. We "see" colors,
but all there "is", are waves and frequencies.

Yes. Math, colors, space, and many other characteristics are
"built-in" in our circuit at birth.

Kant named those "A priori" knowledge. Knowledge of time and
space is independent from experience, and it would correspond
to the implicit knowledge that we build into our programs that
is nowhere made explicit: the type of data the machine is accessing
is character data but that is IMPLICIT in the structure of the
program.
However: there's no reason why a runtime could "know" types and use
them as an interpreter. Each object would be wrapped in type
information.

Yes, that could be possible but that would imply a circuit that
can learn a type at runtime, sometyhing OUR circuit can do but
not the circuits we build. There is no computer able to reason
and deduce the type (class, classification) of its data, and that is
WHY we HAVE TO specify the types explicitely.

More sophisticated software far in the future will be able to reason,
associate inputs with a general CLASS of inputs, i.e. make an abstract
thought. Until then, all information that the circuit has is the one
we give it implicitely.
 
S

spinoza1111

spinoza1111 a écrit :




Yes. Math, colors, space, and many other characteristics are
"built-in" in our circuit at birth.

Kant named those "A priori" knowledge. Knowledge of time and
space is independent from experience, and it would correspond
to the implicit knowledge that we build into our programs that
is nowhere made explicit: the type of data the machine is accessing
is character data but that is IMPLICIT in the structure of the
program.


Yes, that could be possible but that would imply a circuit that
can learn a type at runtime, sometyhing OUR circuit can do but
not the circuits we build. There is no computer able to reason
and deduce the type (class, classification) of its data, and that is
WHY we HAVE TO specify the types explicitely.

I wasn't referring to deduction of the type. I was referring to the
many systems that store the type with the data at run time as the
tuple (value,type).
 
S

spinoza1111

"spinoza1111" <[email protected]> ha scritto nel messaggio

false;

for the remain the true life is out from here,
it is for example when some stranges ask for information
and someone search answers, or it is in see the blue sky
or the green trees and grass

for the remain we have to have always patience one each other
both in real life and here
the our eye not see all someone wrote or each someone act.
we can not judge some other
what we have to do is: "thank you" to all and to everything

who know, some day it is possible, we will see in the real life :)

For now we see through a glass, darkly, but then face to face: now I
know in part; but then shall I know even as also I am known.

1 Corinthians 13
 

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

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top