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
Lassie wrote:
>
"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
worthwhil e changes are small improvements (like mandating function
prototype s 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
overloadin g 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.

Well, if you are using a list and you need the nth element you will
have to start at the start and go to the nth. That is because of the
data structure used.

When you see that you are accessing random elements you change your
declaration to a flexible array and you have more efficient random
access. And you do not need to change the code.

I agree that operator overloading has its drawbacks within this context.

Specially because even if it *can* be used to standardize access to
sequential containers, it needs furthe standards to be able to define
the operations in a meaningful way (like First, next, last, etc).

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Sep 4 '08 #91
Antoninus Twink <no****@nospam. invalidwrote:
>
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...
You mean C++? ;-)
--
Larry Jones

My brain is trying to kill me. -- Calvin
Sep 4 '08 #92
Richard Heathfield <rj*@see.sig.in validwrote:
>
No, I would not be so foolish as to attack you for daring to propose a
change to the C language. I'm just curious as to why you propose it here,
since nobody here has any authority to change the language definition
(except Larry, perhaps, since he's actually a voting member of the ISO C
Committee). It seems rather pointless.
Actually, at the moment I'm not a voting member of the committee. I am,
however, the document editor. Which role provides more *authority* to
change the language definition I can't say, but the latter role
certainly provides more *opportunity* to do so. :-)
--
Larry Jones

I hate being good. -- Calvin
Sep 4 '08 #93
jacob navia <ja***@nospam.c omwrote:
>
How would you make different libraries interoperate with lists,
flexible arrays, arrays, double linked lists, etc?
Like the old joke says: If I were going there, I wouldn't be starting
from here.
--
Larry Jones

Can I take an ax to school tomorrow for ... um ... show and tell? -- Calvin
Sep 4 '08 #94
jacob navia <ja***@nospam.c omwrote:
>
I need 10 thousand euros (15 000 US$) to buy the AFNOR
(French ISO organization) to present my proposal after
I got sponsored by some company.
That's not necessary -- committee meetings are open to the public.
Anyone is welcome to attend and participate in the discussions and even
straw votes, just not formal votes. Requests for agenda time (e.g., for
a presentation) are normally granted, particularly when made reasonably
in advance. The committee even tries to meet in a variety of locations
to make it easier for people to attend.
--
Larry Jones

How am I supposed to learn surgery if I can't dissect anything? -- Calvin
Sep 4 '08 #95
la************@ siemens.com said:

<snip>
Actually, at the moment I'm not a voting member of the committee. I am,
however, the document editor. Which role provides more *authority* to
change the language definition I can't say, but the latter role
certainly provides more *opportunity* to do so. :-)
"He who drafts the document wins the day" - Jay and Lynn, in "Yes,
Minister"

--
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 #96
la************@ siemens.com wrote:
jacob navia <ja***@nospam.c omwrote:
>How would you make different libraries interoperate with lists,
flexible arrays, arrays, double linked lists, etc?

Like the old joke says: If I were going there, I wouldn't be starting
from here.
Very funny.

If you wanted to go there you would not use C isn't it?

Obvious. This is comp.lang.c.

The basic assumption here seems to be
"Any software development should be done in C++". We are here to
(1) remain people not to cast malloc().
(2) The prototype of main is
int main (void)
NOT
void main(void)
(3) i = i++; is not a good idea.
And that was it.

Any serious proposal for discussion meets the same fate.

VERY FUNNY.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Sep 4 '08 #97
la************@ siemens.com wrote:
jacob navia <ja***@nospam.c omwrote:
>I need 10 thousand euros (15 000 US$) to buy the AFNOR
(French ISO organization) to present my proposal after
I got sponsored by some company.

That's not necessary -- committee meetings are open to the public.
If the public can afford the trip, obviously.

I proposed that they set up a web site or similar place
where we could propose things (since they do not bother
to read comp.std.c as I heard in that group in the last
discussion)

No answer.
Anyone is welcome to attend and participate in the discussions and even
straw votes, just not formal votes. Requests for agenda time (e.g., for
a presentation) are normally granted, particularly when made reasonably
in advance. The committee even tries to meet in a variety of locations
to make it easier for people to attend.
Do you know where the next meeting is?

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Sep 4 '08 #98
jacob navia wrote, On 04/09/08 00:08:
Flash Gordon wrote:
>>
Are you claiming that C should be used as a general solution to ALL
programming problems?
You have not answered this question and it is the only part of my post
you have quoted.
Obviously Gwyn thinks that C is good for "System programming",
You obviously think C should not be used for systems programming. So
what language should be used for systems programming? Should I write an
OS in Javascript?
where
it is unclear why system programming needs gets() and trigraphs...

You apparently are of the same opinion.
If you check back you will find I argued in favour of deprecating gets
as a minimum when it was discussed. However, I don't expect you to te
the truth about what other people have stated.
By leaving application programming for other languages, you
effectively destroy C.
OK, some of the developers are working on a web based application and
they need some code to execute on the client (which could be Windows,
Linux, MacOS 9, MacOS X, a Microsoft PDA, a Backberry or anything else.
One requirement for the application being that they do not install
anything on the client. According to you they should write this
client-side code in C and compile it for every target and install it on
thousands of devices at each customer site. Personally I think using one
of the scripting languages is more appropriate, but you obviously disagree.
Application programming should be done in "evolved" languages
and C should be kept at the level of gets() with a library
conceived in the 70s and still bug-compatible with that
one.
The above directly contradicts statements I have made on this group. For
example if you read this thread you will see me arguing for gets being
deprecated as a first step towards it being removed from the standard
http://groups.google.com/group/comp....685069103a8477
I am claiming that C can be used for general application
programming.
So write a client side script for a web application that will work on
the three internet enabled devices I have in this room with any of the
web browsers currently installed (I will permit changing security
setting for this purpose). I will upload the executable you provide on
my web-site and test it. Oh, and I'm not telling you what the devices are.

On the other hand the last major piece of applications programming I did
was in C, and for the next piece part of the job will be converting some
code from Perl to C.
It needs just a single modification
(operator overloading)
Many people disagree with you.
and a rewrite of the standard library
to be able to be very useful in application programming.
I've found it useful in the recent applications programming I've done.
Some things could be improved. As to the networking, graphics and the
like, I just use suitable third-party libraries.
Why?

Because it is a *simple* language. Simple languages are easier to
understand and use, and have less surface for bugs.
I've seen a lot of bugs in code written in simpler languages.
I am opposed to most current trends in language development exactly
because I think that simplicity is a virtue and simple things are
basically much more powerful than complicated ones.
And in that aim you want to make C more complicated.
--
Flash Gordon
Sep 5 '08 #99
jacob navia <ja***@nospam.c omwrote:
Antoninus Twink wrote:
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!
Unfortunately, operator overloading is nothing like milk (after all, I
did not overload Clive Sinclair's operators when I was a programming
baby), but much more like heroin. Sure, there are people who can take
one taste of it and then leave off, but the evidence is overwhelming
that most people get badly addicted.

Richard
Sep 5 '08 #100

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
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...
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...
1
7474
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
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
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.