473,778 Members | 2,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UNIX, C, Perl

Given that UNIX, including networking, is almost entirely coded in C,
how come so many things are almost impossible in ordinary C? Examples:
Network and internet access, access to UNIX interprocess controls and
communication, locale determination, EBCDIC/ASCII discrimination, etc.

Almost all of these are easy in Perl. Why isn't there a mechanism like
perl modules to allow easy extentions for facilities like these? Isn't
anyone working on this problem? or is it all being left for proprietary
systems?
Sep 2 '08
223 7359
On 4 Sep 2008 at 9:02, jacob navia wrote:
Operator overloading is not an objective per se. It is a means of
making libraries that use lists, flexible arrays and other sequential
containers interoperable using the same notation:

data[2]

to acces the third element of a list/array/other
Trouble is, you quickly end up pulling in a whole load of other stuff
too. You start out thinking how nice it is to be able to write

c=(a+b)*d;

instead of

mpf_add(c, a, b);
mpf_mul(c, c, d);

and then before you know it you've got overloaded functions because

b=sqrt(a);

is simpler than

mpf_sqrt(b, a);

Then it's iterators so that you can meaningfully overload ++ to index
your list/array/other...

And before you know it, you've got a horrible mess...

Sep 4 '08 #81
Antoninus Twink wrote:
On 4 Sep 2008 at 9:02, jacob navia wrote:
>Operator overloading is not an objective per se. It is a means of
making libraries that use lists, flexible arrays and other sequential
containers interoperable using the same notation:

data[2]

to acces the third element of a list/array/other

Trouble is, you quickly end up pulling in a whole load of other stuff
too. You start out thinking how nice it is to be able to write

c=(a+b)*d;
This is nice
instead of

mpf_add(c, a, b);
mpf_mul(c, c, d);
That is ugly.
and then before you know it you've got overloaded functions because

b=sqrt(a);

is simpler than

mpf_sqrt(b, a);
lcc-win provides overloaded functions already. Not a big deal.

Then it's iterators so that you can meaningfully overload ++ to index
your list/array/other...
Surely not. That doesn't follow at all. Why it is so complicated
to write a loop?
And before you know it, you've got a horrible mess...
If you do not know how to stop!

Your argument is similar to this:

Antoninus: DO NOT DRINK MILK!!!!
Jacob: But... Why? Milk is tasteful and good for your health.
Antoninus: Yes, but then you drink 8 liters and you are DEAD!

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Sep 4 '08 #82
On 4 Sep 2008 at 17:14, jacob navia wrote:
Antoninus Twink wrote:
>And before you know it, you've got a horrible mess...

If you do not know how to stop!
Sure... unfortunately the main historical example is Bjarne Stroustoup,
who definitely didn't know how to stop!

Personally I see nothing wrong with writing
C-with-the-odd-nice-C++-feature and compiling it with a C++ compiler.

Sep 4 '08 #83
In article <g9**********@a ioe.org>, jacob navia <ja***@nospam.o rgwrote:
>Kenny McCormack wrote in response to loony Eric Sosman:
>Calm down. Take your medicine. You'll feel better soon.
But then Jacob picked up the ball thusly:
>Kenny, you did not answer my post...

You consider C really dead?

I mean your opinion *is* important (at least to me)
Well, thank you for that.

Basically, my opinion is irrelevant (in this context). My purpose in
posting was to alert the newbie to the nature of this newsgroup. Sort
of a "newbie's guide to CLC. Despite the name, this is *not* a
technical newsgroup!". So, at least for the moment, I was parrotting
the view held by the regs (which is that it is for legacy and embedded
only, since their highly restrictive definition of what C is makes it
impossible to do anything interesting in it). This is the view held by
the CLC regs, aka, the Heathfield clique. Heathfield (et al) of course,
denies it all (lying as they always do).

In the "for what it is worth" department...
My own opinion on C is that it is still useful as a systems language
(that is, for building OSs and other useful tools), but since this is
completely outside the scope (read: off topic, not portable, blah, blah,
blah) of this NG, you're kinda stuck. Finally, no, I don't think that,
in 2008, C is an honest choice for new development at the purely
applications level.

Sep 4 '08 #84
On Thu, 4 Sep 2008 17:57:32 +0000 (UTC), ga*****@shell.x mission.com
(Kenny McCormack) wrote:
>In article <g9**********@a ioe.org>, jacob navia <ja***@nospam.o rgwrote:
>>Kenny McCormack wrote in response to loony Eric Sosman:
>>Calm down. Take your medicine. You'll feel better soon.

But then Jacob picked up the ball thusly:
>>Kenny, you did not answer my post...

You consider C really dead?

I mean your opinion *is* important (at least to me)

Well, thank you for that.

Basically, my opinion is irrelevant (in this context). My purpose in
posting was to alert the newbie to the nature of this newsgroup. Sort
of a "newbie's guide to CLC. Despite the name, this is *not* a
technical newsgroup!". So, at least for the moment, I was parrotting
the view held by the regs (which is that it is for legacy and embedded
only, since their highly restrictive definition of what C is makes it
impossible to do anything interesting in it). This is the view held by
the CLC regs, aka, the Heathfield clique. Heathfield (et al) of course,
denies it all (lying as they always do).

In the "for what it is worth" department...
My own opinion on C is that it is still useful as a systems language
(that is, for building OSs and other useful tools), but since this is
completely outside the scope (read: off topic, not portable, blah, blah,
blah) of this NG, you're kinda stuck. Finally, no, I don't think that,
in 2008, C is an honest choice for new development at the purely
applications level.
But a knowledge of C seems to be a prerequisite for learning some other
things, such as Win32, various GUIs, certain modules in Perl, etc. which
are useful for applications.

----
Everybody needs somebody that they can look down on.
If you ain't got noone else, why, help yourself to me.
Sep 4 '08 #85

"James Kuyper" <ja*********@ve rizon.netwrote in message
news:AlPvk.565$ Wd.61@trnddc01. ..
Bartc wrote:
>"Keith Thompson" <ks***@mib.orgw rote in message
news:ln******* *****@nuthaus.m ib.org...
>>jacob navia <ja***@nospam.c omwrites:
>>>C is good only for systems work, etc etc, new development or
applicatio n dveelopment should be done in better languages, etc.

Which, one more time, is not what he said.

Er, I think he did:

"
It is (in my opinion) a mistake to try to push C (in any variant)
as a general solution for all programming problems. It's a
good choice for the systems programming that it was designed for,
although it still has deficiencies even for that. I would rather
the time spent discussing directions for C concentrate more on
remedies for its remaining deficiencies for systems work than on
trying to support applications where there are better choices.
"

Once again, you're converting non-absolute statements into absolute ones.
To show you how you've misinterpreted, I'll rewrite it so that it actually
supports your misinterpretati on:

DISCLAIMER: THIS IS NOT MY OPINION - IT IS NOT DOUG'S OPINION - IT IS NOT
ANYONE'S OPINION, AFAIK:
"It is a mistake to try to push C (in any variant) as a solution for any
programming problem other than the systems programming tasks that it was
designed for, although it still has deficiencies even for that. Time spent
discussing directions for C should be exclusively spend on remedying its
remaining deficiencies for systems work, and not on trying to support
applications where there is always a better choice."

Can you see the difference between my re-write and what he actually said?
Do you understand that your statements apply only to my rewrite, and not
to the original? I only changed a few words, but the result is that it
converts a legitimate point of view (which I don't fully share) into a
statement that could only be made by an idiot.
It's not too hard to read between the lines of the original. Clearly he has
the skills to put across what he thinks without making any hard and fast
commitments. Tact and diplomacy I think it's called.

But the same ideas have been expressed by others in this thread. So in the
clc world at least Jacob seems to be fighting a losing battle in getting any
official support for his work.

--
Bartc

Sep 4 '08 #86
Pilcrow said:
On Thu, 4 Sep 2008 17:57:32 +0000 (UTC), ga*****@shell.x mission.com
(Kenny McCormack) wrote:
<snip>
>>Finally, no, I don't think that,
in 2008, C is an honest choice for new development at the purely
application s level.

But a knowledge of C seems to be a prerequisite for learning some other
things, such as Win32, various GUIs, certain modules in Perl, etc. which
are useful for applications.
Right. It's also a really-nice-to-have for reading technical docs, since
they are often illustrated with C fragments (cases in point:
Aho-Sethi-Ullman (the Dragon Book), Petzold (Programming Windows), Knuth
(TAOCP)). It's good for writing libraries, since so many languages can
link to C libraries nowadays.

And of course it's good for new development at the applications level, if
it's the language that suits you best for that need. For some, it's the
right choice. For others, it isn't. Sweeping generalisations need not
apply.

BTW before taking Kenny McCormack too seriously, check out his technical
contributions to this group (if you can find any).

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Sep 4 '08 #87

"Richard Heathfield" <rj*@see.sig.in validwrote in message
>
And of course it's good for new development at the applications level, if
it's the language that suits you best for that need. For some, it's the
right choice. For others, it isn't. Sweeping generalisations need not
apply.
You don't want lots of languages swilling about your development
environment. Personally I like almost everything in C. However I will knock
up a few Perl scripts to avoid hardcoding paths into C source - they seldom
do anything much I couldn't do as easily in C - and then I've got legacy
Fortran 77 to "maintain".

You get into the way of Fortran 77 coding after a while. Basically you've
got do loops, arrays, if blocks, and gotos. Nothing much else. It's a very
pure programming experience.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Sep 4 '08 #88

"Richard Heathfield" <rj*@see.sig.in validwrote in message news
Malcolm McLean said:
>I trust you are now joining the campaign for 64 bit ints.

Why? They're legal already. In any case, one day they will be too small.
Think the campaign for real ale rather than the campaign to free the weed.

I don't think we will actually run out of integers with 64 bits. With 32
bits yes, you can't quite give one to everyone in the world. But 64 bits
aren't going to have that problem for a long time yet.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm
Sep 4 '08 #89

"jacob navia" <ja***@nospam.c omschreef in bericht
news:g9******** **@aioe.org...
Ian Collins wrote:
>Richard Heathfield wrote:
>>Ian Collins said:

So my point is C fills its (large) niche very well and the only
worthwhile changes are small improvements (like mandating function
prototypes and expunging gets) to improve the quality of C code.
Actually, the really worthwhile changes are never going to happen. For
example, I do actually think it would be worth adding operator
overloading to C - but I know that ISO is never going to buy that, and I
don't see any point in fighting a losi... well, not /that/ losing
battle, anyway.
I'm sure they would be, but how many embedded C compiler vendors are
offering operator overloading as an extension?

Operator overloading is not an objective per se. It is a means of making
libraries that use lists, flexible arrays and other sequential
containers interoperable using the same notation:

data[2]

to acces the third element of a list/array/other
I really would not implement operator[] for a linked list. operator[] has
the semantics of being a random access operator. A linked list is not a data
stucture one would use when random access is needed and operator[] would
have to loop to the correct index every time which is suddenly invisible
from the programmer.
Sep 4 '08 #90

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6557
by: dpackwood | last post by:
Hello, I have two different scripts that do pretty much the same thing. The main perl script is on Windows. It runs and in the middle of it, it then calls out another perl script that then should run on a Unix box I have. Both scripts run ok, except for the part when Windows try's to call out the Unix script. I have it set up where the Unix is mapped through a drive letter and can drop stuff into the Unix box. It is going through another...
2
5672
by: Mohsin | last post by:
Hi all, I have a perl program which makes a user exit to the O/S (unix, solaris) to issue a O/S command. I know that the shell it invokes is NOT a korn shell, because I captured the shell info into a file with a 'ps' command. My question is "How to explicitly specify a Korn shell to be used by perl?" Eg of my perl code: ## Begin code snippet..
0
6448
by: Danny Jensen | last post by:
I need to test if certain processes on a unix box were running. I wanted to use whatsup gold to do the testing. First I needed to go to the whatsup configure>monitors & services menu to add this tcp/ip port 1555 service with the folowing lines: Send=psef /dj/myco/rf.monitor\r\n Expect=~1 the psef above is a command that the unix server executes. The unix box communicates back a 1 if the test is successful and a 0 if it is
1
17721
by: Al Belden | last post by:
Hi all, I've been working on a problem that I thought might be of interest: I'm trying to replace some korn shell scripts that search source code files with perl scripts to gain certain features such as: More powerful regular expressions available in perl Ability to print out lines before and after matches (gnu grep supports this but is not availble on our Digital Unix and AIX platforms) Make searches case insensitive by default (yes, I...
6
1671
by: asimorio | last post by:
Hi folks, Recently, I am investigatin a memory leak issue. I have written a simple C++ program and a Perl script to test on UNIX environment machine. I do a for loop to new up 20 char of size 32768 bytes, then delete them. Please see below: //// part of the code start //// for (i=0; i<20; i++) { ptrA = new (std::nothrow) char;
2
4275
by: perlnewbie | last post by:
Hi everyone I am new to perl and I am writing a perl script to invoke a set of commands on UNIX clearcase vob however I am having trouble after setting the view and mounting the vob I want to change the directory into the vob and then using Cwd or pwd to confirm I am in the vob to continue the CC functions. Sample code in perl : $Result = system 'cleartool setview admin_view'; $Result = system ('cleartool mount /vobs/test');
4
3790
by: jane007 | last post by:
Hello everybody: I am having a problem. On Unix platform, there is a script that need user to input data from console, then when I call Unix perl script from Windows, these is an issue occurs, when I input data and enter "enter" so fast, the Windows console is freezed, I don't know why, does anybody know?Thank you very much. My code like follows:
4
4274
by: mdshafi01 | last post by:
Hi , I am trying to send mail from unix perl. I am using following code to send mail. It is not triggering mail and also it is not giving any error. please tell me any special settings are required or this program should be executed from special user with higher permission or something. please tell me.
1
3983
by: dxz | last post by:
I have a perl script to run on both UNIX and Windows. How should I write the Shabang line: On UNIX, it is #!/usr/bin/perl On Windows, it is #!C:\perl\bin\perl.exe Which one should I use? Should I combine them? If yes, how?
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9465
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10296
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10068
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2863
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.