Sunday, November 13, 2011

comp.lang.c - 21 new messages in 6 topics - digest

comp.lang.c
http://groups.google.com/group/comp.lang.c?hl=en

comp.lang.c@googlegroups.com

Today's topics:

* Using multiple files in (Borland) C - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/6ec1cf4dd3d25909?hl=en
* John McCarthy died today. - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/f47056646de81225?hl=en
* Which lean C compiler for 32-bit OS development - 8 messages, 6 authors
http://groups.google.com/group/comp.lang.c/t/342beb57fe7f8f7b?hl=en
* qsort - 5 messages, 4 authors
http://groups.google.com/group/comp.lang.c/t/4458f0b220a8f30c?hl=en
* Why don't C comments nest? - 2 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/64ce87cf72050c93?hl=en
* how can i find the size of a binary file - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.c/t/b2bd04562244c13f?hl=en

==============================================================================
TOPIC: Using multiple files in (Borland) C
http://groups.google.com/group/comp.lang.c/t/6ec1cf4dd3d25909?hl=en
==============================================================================

== 1 of 1 ==
Date: Sat, Nov 12 2011 3:07 pm
From: Jorgen Grahn


On Fri, 2011-11-11, Ruud wrote:
> Hallo allemaal,
>
> For most of my projects I used Turbo Pascal so far. I studied C but
> more to see how programs were made and then to write them in TP. I
...
> you need H-files in C to do the same trick. But that didn't work out
> under Borland C 3.1.

Perhaps you know already, but it's worth mentioning: you are using
prehistorical tools. Turbo Pascal was discontinued fifteen years ago,
Borland C++ 3.1 was superceded eighteen years ago. Things have
happened in computing since the early 1990s; you may want to upgrade ...

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

==============================================================================
TOPIC: John McCarthy died today.
http://groups.google.com/group/comp.lang.c/t/f47056646de81225?hl=en
==============================================================================

== 1 of 2 ==
Date: Sat, Nov 12 2011 3:22 pm
From: Jorgen Grahn


On Thu, 2011-11-10, Kenny McCormack wrote:
...
> And anyway, isn't it a standard dogma of this group that C and C++ are
> completely different languages with almost nothing in common? That's what I
> hear all the time...

They are completely different languages, with a lot in common.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .


== 2 of 2 ==
Date: Sat, Nov 12 2011 5:44 pm
From: Kaz Kylheku


On 2011-11-12, Jorgen Grahn <grahn+nntp@snipabacken.se> wrote:
> On Thu, 2011-11-10, Kenny McCormack wrote:
> ...
>> And anyway, isn't it a standard dogma of this group that C and C++ are
>> completely different languages with almost nothing in common? That's what I
>> hear all the time...
>
> They are completely different languages, with a lot in common.

Your English dictionary must have something bizarre under the "completely"
entry.

==============================================================================
TOPIC: Which lean C compiler for 32-bit OS development
http://groups.google.com/group/comp.lang.c/t/342beb57fe7f8f7b?hl=en
==============================================================================

== 1 of 8 ==
Date: Sat, Nov 12 2011 3:24 pm
From: Borax Man


James Harris wrote:

> On Nov 12, 10:37 am, jacob navia <ja...@spamsink.net> wrote:
>> Le 12/11/11 11:09, James Harris a écrit :
>
> ...
>
>> >> I guess a JIT would be much better for your needs. I have one
>> >> for Windows, Linux, AIX, or Macintosh.
>>
>> > A JIT? You mean for platform independence? From the name I imagine lcc-
>> > win32 is kind of tied-in to Windows too much for my purposes but I'll
>> > take a closer look.
>
> ...
>
>> A JIT is just a code generator that doesn't generate any object file.
>>
>> You pass it a string of C code and it will produce in memory an
>> executable function that you can call right away.
>
> I did say I wanted to generate object files.
>
>> Much better than DLLs or shared objects.
>
> Maybe but not for this application!
>
> James

I would say GCC.

There is a DOS port called DJGPP.

There is a Windows port called MinGW which does not require Cygwin. I have
used MinGW under Windows XP without Cygwin installed. Works fine.


www.mingw.org

For assembler code, you can use the included assembler GAS, or if you prefer
(and I do too), NASM, which again, there are ports for DOS, Windows and
Unix.

GCC and optionally NASM will do all that you require.


== 2 of 8 ==
Date: Sat, Nov 12 2011 6:59 pm
From: Nobody


On Sat, 12 Nov 2011 01:22:45 -0800, James Harris wrote:

> gcc is good on Unix but looks very complex to port and I think it needs
> Cygwin on Windows.

It doesn't. MinGW is the standard "native" Windows port of gcc. The
standard 32-bit DOS port of gcc is DJGPP.

== 3 of 8 ==
Date: Sat, Nov 12 2011 7:13 pm
From: Joe Wright


On 11/12/2011 21:59, Nobody wrote:
> On Sat, 12 Nov 2011 01:22:45 -0800, James Harris wrote:
>
>> gcc is good on Unix but looks very complex to port and I think it needs
>> Cygwin on Windows.
>
> It doesn't. MinGW is the standard "native" Windows port of gcc. The
> standard 32-bit DOS port of gcc is DJGPP.
>
Indeed.

--
Joe Wright
"If you rob Peter to pay Paul you can depend on the support of Paul."


== 4 of 8 ==
Date: Sat, Nov 12 2011 7:38 pm
From: BGB


On 11/12/2011 7:59 PM, Nobody wrote:
> On Sat, 12 Nov 2011 01:22:45 -0800, James Harris wrote:
>
>> gcc is good on Unix but looks very complex to port and I think it needs
>> Cygwin on Windows.
>
> It doesn't. MinGW is the standard "native" Windows port of gcc. The
> standard 32-bit DOS port of gcc is DJGPP.
>

however, getting GCC built from sources is still fairly difficult IME,
which could make it extra difficult to port to a new OS.

another downside is that it is often built in a form customized for a
particular target OS, meaning that using it as a cross compiler may
require building it from sources, and dealing with the usual hassles of
getting it built.

however, certain common combinations are fairly easy to get pre-built,
for example MinGW is available prebuilt on many Linux distros (as well
as its use on Windows), so if one is looking to cross-compile for an
environment using x86 and PE/COFF, then one may well be in luck.

typically, support for raw binaries is also available (in most GCC
builds I have seen), although I wouldn't "generally" recommend using raw
binaries without good reason.


it is also a fairly large and complex codebase (and difficult to make
sense out of).

also, some (many) people (myself included) find the GAS syntax to be
rather nasty (I personally much prefer Intel/NASM/... style syntax).

I am not certain if there is a way to get GCC to produce Intel-style
output (I think there may be, but I haven't really looked into it).


I also have my own C compiler, although I rather doubt it would be what
you are looking for (it is designed for JIT and working mostly in the
context of a VM, rather than producing statically-compiled standalone
code, and is also very buggy and is not well maintained at present...).


or such...


== 5 of 8 ==
Date: Sat, Nov 12 2011 8:42 pm
From: "ankh"

"James Harris" <james.harris.1@googlemail.com> wrote in message
news:d8ffed0a-4278-44a3-a92e-36fb75c1e240@p1g2000yqh.googlegroups.com...
> Help! I've written a fair amount of C code over the years and always
> interfaced it with other C. Now I'm looking to interface it with non-C
> code I'm struggling to find a compiler to do what I want. I'm looking
> for a compiler with these qualities:

Troll alert!! Have the newsgroup participants been so boned that you can
post that lame of a bait and get bites?


== 6 of 8 ==
Date: Sat, Nov 12 2011 8:43 pm
From: "ankh"

"jacob navia" <jacob@spamsink.net> wrote in message
news:j9lem0$jrq$1@speranza.aioe.org...
> Le 12/11/11 10:22, James Harris a écrit :
>> In searching around I came across lcc and lcc-win. Remembering Jacob
>> posts here make me think about asking on this newsgroup. I hope the
>> query is just about close enough to being on topic! Any suggestions -
>> even partial matches to the list above - would be appreciated.
>>
>
> You will find mostly negative answers about my work in this group.
>
> Anyway my compiler system has been used extensively as a back end
> For instance for the Eiffel language by the SmartEiffel compiler
> by ML4 (a 4GL language) and as a JIT for an SQL--> C database
> engine.
>
> I guess a JIT would be much better for your needs. I have one
> for Windows, Linux, AIX, or Macintosh.
>
> jacob
>

The song remains the same, huh jake.


== 7 of 8 ==
Date: Sat, Nov 12 2011 10:03 pm
From: "ankh"


Joe Wright wrote:
> On 11/12/2011 21:59, Nobody wrote:
>> On Sat, 12 Nov 2011 01:22:45 -0800, James Harris wrote:
>>
>>> gcc is good on Unix but looks very complex to port and I think it
>>> needs Cygwin on Windows.
>>
>> It doesn't. MinGW is the standard "native" Windows port of gcc. The
>> standard 32-bit DOS port of gcc is DJGPP.
>>
> Indeed.

RIP.


== 8 of 8 ==
Date: Sun, Nov 13 2011 12:00 am
From: James Harris


On Nov 13, 3:38 am, BGB <cr88...@hotmail.com> wrote:

...

> >> gcc is good on Unix but looks very complex to port and I think it needs
> >> Cygwin on Windows.
>
> > It doesn't. MinGW is the standard "native" Windows port of gcc. The
> > standard 32-bit DOS port of gcc is DJGPP.
>
> however, getting GCC built from sources is still fairly difficult IME,
> which could make it extra difficult to port to a new OS.
>
> another downside is that it is often built in a form customized for a
> particular target OS, meaning that using it as a cross compiler may
> require building it from sources, and dealing with the usual hassles of
> getting it built.

Do you know what would be needed in a new OS for it to run gcc? I've
never looked into it but I presume at least a clib for that OS would
be required. (The new kernel is not intended to support Unix system
calls, at least natively, though I could add a translation layer.)

> however, certain common combinations are fairly easy to get pre-built,
> for example MinGW is available prebuilt on many Linux distros (as well
> as its use on Windows), so if one is looking to cross-compile for an
> environment using x86 and PE/COFF, then one may well be in luck.

A few people have mentioned MinGW. The whole gcc thing is bulky but I
do like some of the code generation options it has such as pic, omit
frame pointer and various optimisations. I'd still rather define the
calling conventions myself but that's not something C programmers
typically want to do so is a bit off topic here.

> typically, support for raw binaries is also available (in most GCC
> builds I have seen), although I wouldn't "generally" recommend using raw
> binaries without good reason.
>
> it is also a fairly large and complex codebase (and difficult to make
> sense out of).
>
> also, some (many) people (myself included) find the GAS syntax to be
> rather nasty (I personally much prefer Intel/NASM/... style syntax).

Me too.

> I am not certain if there is a way to get GCC to produce Intel-style
> output (I think there may be, but I haven't really looked into it).

gcc has had the -masm switch added to generate asm output in something
closer to Intel syntax. At least the operands end up in Intel order.

> I also have my own C compiler, although I rather doubt it would be what
> you are looking for (it is designed for JIT and working mostly in the
> context of a VM, rather than producing statically-compiled standalone
> code, and is also very buggy and is not well maintained at present...).

Yes, different requirements. Of the non-gcc compilers I've found so
far tcc looks most promising for being small and simple. Its object
code is far from optimised, though, (and is also in gas format).

James

==============================================================================
TOPIC: qsort
http://groups.google.com/group/comp.lang.c/t/4458f0b220a8f30c?hl=en
==============================================================================

== 1 of 5 ==
Date: Sat, Nov 12 2011 4:10 pm
From: "Bill Cunningham"


pete wrote:
> return *aa > *bb ? -1 : *aa != *bb;

Can you show me that for loop that's not in shorthand? This is kind of
hard to read.

Bill


== 2 of 5 ==
Date: Sat, Nov 12 2011 4:40 pm
From: Keith Thompson


"Bill Cunningham" <nospam@nspam.invalid> writes:
> pete wrote:
>> return *aa > *bb ? -1 : *aa != *bb;
>
> Can you show me that for loop that's not in shorthand? This is kind of
> hard to read.

What for loop?

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


== 3 of 5 ==
Date: Sat, Nov 12 2011 7:42 pm
From: pete


Bill Cunningham wrote:
>
> pete wrote:
> > return *aa > *bb ? -1 : *aa != *bb;
>
> Can you show me that for loop that's not in shorthand?
> This is kind of hard to read.

if (*aa > *bb) {
return -1;
} else {
if (*aa != *bb) {
return 1;
} else {
return 0;
}
}

--
pete


== 4 of 5 ==
Date: Sat, Nov 12 2011 10:39 pm
From: "Bill Cunningham"


Keith Thompson wrote:
> "Bill Cunningham" <nospam@nspam.invalid> writes:
>> pete wrote:
>>> return *aa > *bb ? -1 : *aa != *bb;
>>
>> Can you show me that for loop that's not in shorthand? This is
>> kind of hard to read.
>
> What for loop?

Ok I saw the ?: and thought it might be part of for.

Bill


== 5 of 5 ==
Date: Sat, Nov 12 2011 10:51 pm
From: Ian Collins


On 11/13/11 07:39 PM, Bill Cunningham wrote:
> Keith Thompson wrote:
>> "Bill Cunningham"<nospam@nspam.invalid> writes:
>>> pete wrote:
>>>> return *aa> *bb ? -1 : *aa != *bb;
>>>
>>> Can you show me that for loop that's not in shorthand? This is
>>> kind of hard to read.
>>
>> What for loop?
>
> Ok I saw the ?: and thought it might be part of for.

Doesn't a for loop normally include the word "for"?

--
Ian Collins

==============================================================================
TOPIC: Why don't C comments nest?
http://groups.google.com/group/comp.lang.c/t/64ce87cf72050c93?hl=en
==============================================================================

== 1 of 2 ==
Date: Sat, Nov 12 2011 4:32 pm
From: Keith Thompson


"BartC" <bc@freeuk.com> writes:
[...]
> What you're saying then is that /*...*/ comments are not a suitable
> mechanism for commenting out code? The reason being that code might contain
> (in perhaps one program in a thousand) a '*/' or "*/" token? Yet everyone
> does this, and the world hasn't yet ended.

/*...*/ comments are not a suitable mechanism for commenting out code
because code often includes its own /*...*/ comments, and they don't
nest.

Most of the issues involving '*/' or "*/" tokens don't even arise until
you start talking about changing the language to allow /*...*/ comments
to nest, and any such change would break existing code.

It's been mentioned several times that changing the language to allow
/*...*/ comments to nest would break existing code. If you've ever
acknowledged that very important point, I've missed it.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


== 2 of 2 ==
Date: Sat, Nov 12 2011 4:36 pm
From: Keith Thompson


Willem <willem@toad.stack.nl> writes:
> Keith Thompson wrote:
> ) Willem <willem@toad.stack.nl> writes:
> )> Which is why I have changed my preference to writing this:
> )>
> )> some_function(10 /* param1 */
> )> ,20 /* param2 */
> )> #if 0
> )> ,30 /* param3 */
> )>

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate