binary executable

E

Erwin Moller

Why is a binary file executable? Is any binary file executable? Is
only binary file executable? Are all executable files binary? What is
the connection between the attribute of binary and that of executable?
 
E

Erwin Moller

Is every binary file executable?

Victor said:
Why is sky green?


Well, did you mean to say "every"? Some files are executable.
But not every file executable. Now, what "binary" has to do
with this, I can't tell. Can you? What's "binary"?


Uh... What's "binary"?


Uh... Same question, what's "binary"?


Define "binary". Executable files usually have a special
format that allows the operating system to recognize them
as file containing images of executable programs. "Binary"
is not well defined.

V
 
I

Ian Collins

Erwin Moller wrote:

[please don't top-post]
Is every binary file executable?
Define a binary file.

While you are thinking about that, is a JPEG image executable?
 
I

Ian Collins

Erwin said:
Erwin Moller wrote:

[please don't top-post]
Is every binary file executable?
Define a binary file.

While you are thinking about that, is a JPEG image executable?

Is binary file vague concept?

It certainly isn't defined in terms of C++. Some platforms
differentiate between binary and text files, others do not.
 
J

Joe Greer

Erwin Moller wrote:

[please don't top-post]
Is every binary file executable?

Define a binary file.

While you are thinking about that, is a JPEG image executable?

Is binary file vague concept?

Well, from the computer's POV all files are binary. Traditionally, any
file that isn't human readable is considered binary and they come in all
shapes and sizes. Some of those files will be executable and some won't.
For example, an SQL database will be binary, but won't be executable. On
the other hand, script languages are executable and are also human
readable. The concepts are orthoganal in that regard.

HTH,
joe
 
S

Stefan Ram

Victor Bazarov said:
If one would be strict in that regard, then only bootstrap program
is truly executable, and everything else is data, _especially_ scripts,
which are but the source data to the corresponding interpreter...

To be executed or interpreted is a /rôle/ of an entity - not a
property. A rôle of an entity depends on a context of an
entity, while a property only depends on the entity.

A processor is an interpreter implemented in hardware -
otherwise »execution« and »interpretation« is the same.

Off the topic »c++«: While ISO/IEC 14882:2003(E) does not use
the term »binary« for executable files, the Java Language
Specification, Third Edition indeed does use this term
»binary« for »executable«.

For example,

»Loading refers to the process of finding the binary form
of a class or interface type with a particular name,
perhaps by computing it on the fly, but more typically by
retrieving a binary representation previously computed
from source code by a compiler, and constructing, from
that binary form, a Class object to represent the class or
interface.«

http://java.sun.com/docs/books/jls/third_edition/html/execution.html#12.2.
 
R

robertwessel2

Why is a binary file executable? Is any binary file executable? Is
only binary file executable? Are all executable files binary? What is
the connection between the attribute of binary and that of executable?


Calling an executable (or sometime an object) file a "binary" is more
slang than anything formal. You can take it to mean to file contains
something approximating machine code. Whether that has any relation
to anything called a "binary" file on your particular platform, or
even if your platform has anything called a "binary file," is a whole
different issue. For example, executables (and object files) on zOS
are in a structured* file format, which is not really anything to
would map conceptually to a *nix style stream type file (of either
binary or text forms). But those are still semi-commonly called
"binaries."

The term is also used with some frequency for the image files
containing the data (instructions and whatnot) intended to be burned
into a ROM or similar for embedded systems, even though those files,
for historical reasons, often actually contain ASCII hex.

Java byte code and MSIL (.NET) executables are also often called
binaries (which would fall under "approximating machine code").


*IOW, the file actually consists of independent records and other
goodies, rather than a stream of bytes.
 
D

Daniel Pitts

Victor said:
Joe said:
[..] For example, an SQL database will be binary, but won't be
executable. On the other hand, script languages are executable and
are also human readable. The concepts are orthoganal in that regard.

If one would be strict in that regard, then only bootstrap program
is truly executable, and everything else is data, _especially_ scripts,
which are but the source data to the corresponding interpreter...

V
No, the bootstrap program is also data, to be interpreted by the hardware.

The hardware is only data that is interpreted by the universe and
physicists.

LISP is the rest.
 
J

James Kanze

Some systems distinguish between text and non-text (i.e.
binary) files. Not all do. The ones that do, will perform
various text translations when writing to a text file.

If the system distinguishes, then the C++ library will likely do
more than just text translations---you probably won't be able to
open a file unless the mode corresponds to the one it was
written in.

A lot of systems have conventions concerning what goes into a
text file, even if the system itself doesn't have different file
types for binary and text. In such cases, the standard library
will normally ensure a translation between the system's
conventions and those imposed by the C++ standard. (Also:
because they are conventions, and not part of the system, they
are often a little bit vague. Under Windows, for example, some
programs treat the sequence 0x0D,0x0A as a line terminator,
others as a line separator.)

As a general rule, a file is considered "text" if its contents
can be interpreted as printable characters, plus a few control
characters such as new line, in some encoding, and 2) it
conforms more or less to the system conventions with regards to
things like how newline and end of file are represented.
Although even 2 is somewhat uncertain: most Windows programs
I've seen consider text files from Unix to be text, even if they
don't conform to the Windows convention for new line. And a
growing number of Unix programs can handle Windows conventions.

Anything which isn't considered "text" is considered "binary".
There is none. What makes a file "binary" is not its contents,
but whether or not you included ios::binary in the optional
flags argument to fstream::eek:pen.

At one level. At the system level, of course, different
criteria apply, see above.

And again, the distinction as to what is executable and what
isn't isn't always clear: under Unix, there's an executable mode
bit, but not all files on which is is set will be executable.
For that matter: if I generate a .exe file with VC++, it's
really an executable, right? Even if I do so on a shared mount,
and am looking at it under Solaris? Are my bash shell scripts
executable even if I mount the file system on a machine on which
bash isn't installed. (Don't have any here, but Posix only
requires the Korn shell---and one could imagine thus that a bash
shell script be executable on some machines running Solaris, but
not on others.)
On systems that care, you can open a file that has text in it
as binary to avoid the translations that would happen if you
opened it as text.

Again, you're playing with language: the distinction text/binary
has a different meaning with regards to the C++ standard library
than it does in general use. And just because you opened a file
in binary doesn't mean that none of the text related
translations will occur; some depend on the mode of open, but
others (e.g. code translation) depend on the imbued locale.
You can also do the opposite, but that's rarely useful;
text-mode translations generally FUBAR any binary data.

Yes. Historically, binary meant transparent. That convention
was broken by the C++ committee, however.

And of course, the open mode doesn't really affect how you
interpret the data in your program. Although it doesn't
generally make sense to do so, you can always interpret the
binary value of a char variable as binary data, rather than as a
character code.
 

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,787
Messages
2,569,629
Members
45,329
Latest member
InezZ76898

Latest Threads

Top