From: Herbert Kleebauer on
santosh wrote:
> On Friday 20 Jul 2007 2:36 am, Herbert Kleebauer <klee(a)unibwm.de>

> > There is only one real warning:
> >
> >> windela.c:5611: warning: operation on ?j? may be undefined
> >
> > But this shouldn't be flaged as a warning but as an error.
> >
> > case 0x05: {la[--j] = la[j] / la[j+1]; break;}
>
> Why should this be an error? This exhibits undefined behaviour, but
> that doesn't mean compilation should be stopped.

I don't care whether the compilation stops or not. But if the
behaviour of the generated code not only depends on the C source
code but also on the concrete implementation of the compiler, then
the source code is incorrect. And therefore an error and not a warning
has to be generated.

> > With this code, Windela shouldn't work properly when compiled
> > with GCC on a SUN (but this was my first C program and you only
> > learn by making errors).
>
> Why only on the SUN? This code should invoke undefined behaviour on
> all implementations, since 'j' is modified more than once between
> sequence points.

It doesn't invoke undefined behaviour but a compiler dependent
behaviour. I didn't say "only on the SUN". I used a similar statement
in a program to generate pdf files. It was ok when compiled with
gcc in DOS and Linux but not when compiled with gcc on a SUN.
Seems the DOS/Linux version of gcc first evaluates the left side
and then the right side whereas the opposite is true for gcc on a
SUN.
From: Herbert Kleebauer on
"T.M. Sommers" wrote:
> Herbert Kleebauer wrote:

> > Very funny warnings. I always use int instead of void (because
> > then you can use the implicit declaration) and just return nothing.
>
> Just because you always do it does not mean that it is conforming
> C. Just because you get away with it today does not mean that
> you will tomorrow. Implicit int is no longer a part of the
> language. Neither is a non-void function not having a return.

First you have to define what "the C language" is. For me it is
the language which my C compiler accepts. And I had never problems
with "implicit int", a missing return value or the much better good
old way of function headers:

int ins_lab(p,wert,g) char *p; long wert; int g;

Maybe you also will tell me, that a x86 assembler doesn't accept
something like "move.l r0,r4". My assembler does and I don't
care about what's written in an Intel or MASM manual or an
ANSI C specification. It only matters what the C compiler
accept and not what an organization thinks the compiler should
accept (I also like the support of nested functions in gcc).
From: T.M. Sommers on
Herbert Kleebauer wrote:
> "T.M. Sommers" wrote:
>>Herbert Kleebauer wrote:
>
>>>Very funny warnings. I always use int instead of void (because
>>>then you can use the implicit declaration) and just return nothing.
>>
>>Just because you always do it does not mean that it is conforming
>>C. Just because you get away with it today does not mean that
>>you will tomorrow. Implicit int is no longer a part of the
>>language. Neither is a non-void function not having a return.
>
> First you have to define what "the C language" is. For me it is
> the language which my C compiler accepts.

For the rest of the world, it is what is defined in the standards
document.

> I don't
> care about what's written in an Intel or MASM manual or an
> ANSI C specification. It only matters what the C compiler
> accept and not what an organization thinks the compiler should
> accept (I also like the support of nested functions in gcc).

If that is your attitude, expect trouble if you ever switch
compilers.

--
Thomas M. Sommers -- tms(a)nj.net -- AB2SB

From: Evenbit on
On Jul 19, 8:48 am, Frank Kotler <fbkot...(a)verizon.net> wrote:
> santosh wrote:
> > On Thursday 19 Jul 2007 4:11 pm, Frank Kotler <fbkot...(a)verizon.net>
> > wrote in message <EdHni.5682$bP4.2953(a)trndny01>:
>
> >>>"santosh" <santosh....(a)gmail.com> wrote in message
> >>>news:f7n54g$mv1$1(a)aioe.org...
>
> > [ ... ]
>
> >>>><http://137.193.64.130/windela.zip>
>
> >>>>Or search the group for more links.
> >>>>IIRC instructions are implemented only uptil the 486, and the
> >>>>compile crashed for me on Linux.
>
> >>I found I had to rename the file to a lower-case ".c" before it
> >>would compile with gcc (Linux). Upper case ".C" implies C++, or
> >>some nonsense. Compiled and worked fine for me. (yeah, "-Wall
> >>-pedantic" makes gcc complain... so don't)
>
> > Oops. Excuse my stupidity.
>
> It was news to me, too. Very little stupidity around here. Most of us
> are pretty smart (and almost all of us think we are). But all of us are
> smarter than any of us!
>

What?? Nobody read 'man' pages anymore?? I'm surprised that santosh
didn't know this one.

<clip>
Options Controlling the Kind of Output

Compilation can involve up to four stages: preprocessing,
compilation
proper, assembly and linking, always in that order. GCC is
capable of
preprocessing and compiling several files either into several
assembler
input files, or into one assembler input file; then each
assembler
input file produces an object file, and linking combines all
the object
files (those newly compiled, and those specified as input) into
an exe-
cutable file.

For any given input file, the file name suffix determines what
kind of
compilation is done:

file.c
C source code which must be preprocessed.

file.i
C source code which should not be preprocessed.

file.ii
C++ source code which should not be preprocessed.

file.m
Objective-C source code. Note that you must link with the
libobjc
library to make an Objective-C program work.

file.mi
Objective-C source code which should not be preprocessed.

file.mm
file.M
Objective-C++ source code. Note that you must link with
the
libobjc library to make an Objective-C++ program work.
Note that
.M refers to a literal capital M.

file.mii
Objective-C++ source code which should not be preprocessed.

file.h
C, C++, Objective-C or Objective-C++ header file to be
turned into
a precompiled header.

file.cc
file.cp
file.cxx
file.cpp
file.CPP
file.c++
file.C
C++ source code which must be preprocessed. Note that
in .cxx, the
last two letters must both be literally x. Likewise, .C
refers to
a literal capital C.

file.hh
file.H
C++ header file to be turned into a precompiled header.

file.f
file.for
file.FOR
Fortran source code which should not be preprocessed.

file.F
file.fpp
file.FPP
Fortran source code which must be preprocessed (with the
tradi-
tional preprocessor).

file.r
Fortran source code which must be preprocessed with a
RATFOR pre-
processor (not included with GCC).

file.f90
file.f95
Fortran 90/95 source code which should not be preprocessed.

file.ads
Ada source code file which contains a library unit
declaration (a
declaration of a package, subprogram, or generic, or a
generic
instantiation), or a library unit renaming declaration (a
package,
generic, or subprogram renaming declaration). Such files
are also
called specs.

file.adb
Ada source code file containing a library unit body (a
subprogram
or package body). Such files are also called bodies.

file.s
Assembler code.

file.S
Assembler code which must be preprocessed.

other
An object file to be fed straight into linking. Any file
name with
no recognized suffix is treated this way.

You can specify the input language explicitly with the -x
option:

-x language
Specify explicitly the language for the following input
files
(rather than letting the compiler choose a default based on
the
file name suffix). This option applies to all following
input
files until the next -x option. Possible values for
language are:

c c-header c-cpp-output
c++ c++-header c++-cpp-output
objective-c objective-c-header objective-c-cpp-
output
objective-c++ objective-c++-header objective-c++-
cpp-output
assembler assembler-with-cpp
ada
f77 f77-cpp-input ratfor
f95
java
treelang

-x none
Turn off any specification of a language, so that
subsequent files
are handled according to their file name suffixes (as they
are if
-x has not been used at all).

<clip>

Nathan.

From: Evenbit on
On Jul 19, 6:59 am, Herbert Kleebauer <k...(a)unibwm.de> wrote:
> santosh wrote:
> > IIRC instructions are implemented only uptil the 486, and the compile
> > crashed for me on Linux.
>
> gcc -O2 windela.c -o lindela
>
> crashed?????


I got that to work and ./lindela runs but when I try to feed it an
file from /EXAMPLE/LINUX it bombs with what I assume to be some German
expletives.

Is this thing PD, GPL, or what? Do you mind if I tuck it somewhere
"safe" on the 'net so it'd be available long after your server "powers
down" for the last time?

Nathan.

First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Prev: masm linking from console
Next: NASM HelloWorld - DOS