473,776 Members | 1,606 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 7349
On Sep 4, 10:45 pm, jacob navia <ja...@nospam.c omwrote:
Lassie wrote:
"jacob navia" <ja...@nospam.c omschreef in bericht
news:g9******** **@aioe.org...
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.
And if you need the three elements 'n', 'n+1' and 'n+2', do you search
or each of them from the start of the list (what operator[] would have
to do), or do you only write a loop to the first one, and access the
other two by following a link from the element you currently have?
>
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.
And when you find that you only access successive elements, you drop
the library that foolishly uses operator[] to access elements in a
linked list.
You would have to change the code, but you get a several orders of
magnitude performance gain in return.
>
--
jacob navia
Bart v Ingen Schenau
Sep 5 '08 #111

"Bart van Ingen Schenau" <Ba************ ********@ict.nl wrote in message
news:aa******** *************** ***********@d45 g2000hsc.google groups.com...
On Sep 4, 10:45 pm, jacob navia <ja...@nospam.c omwrote:
>Lassie wrote:
I really would not implement operator[] for a linked list. operator[]
>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.

And if you need the three elements 'n', 'n+1' and 'n+2', do you search
or each of them from the start of the list (what operator[] would have
to do), or do you only write a loop to the first one, and access the
other two by following a link from the element you currently have?
And when you find that you only access successive elements, you drop
the library that foolishly uses operator[] to access elements in a
linked list.
I created a scripting language once with arrays implemented as a linked list
(actually, as a block of 8 elements).

This remembered the last visited element, so [] indexing was reasonably
quick provided the application acccessed the array more or less
sequentially.

For C which is used to array accesses taking a couple of machine
instructions, even doing this would be quite a performance hit. Memory
management would be far easier though.

But, if the alternative was to use a higher-level (interpreted) language for
the extra
flexibility, then C + linked-list arrays + []indexing could be viable.

--
Bartc

Sep 5 '08 #112
jacob navia <ja***@nospam.c omwrote:
la************@ siemens.com wrote:

That's not necessary -- committee meetings are open to the public.

If the public can afford the trip, obviously.
Obviously. Like I said, however, the committee does try to meet in
various locations to make it easier for people to attend, but we're
limited to locations where someone is willing to host us (which requires
a not insubstatial expense). As you can see from the committee's web
site, we've been pretty successful in the past:

<http://www.open-std.org/jtc1/sc22/wg14/www/meetings>
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.
That's because you proposed it in comp.std.c, which you already know
most committee members don't read! And the reason we don't do it is the
same as the reason most members don't read comp.std.c -- if we did, we
would be inundated with half-baked suggestions from dilettantes who
would expect us to spend time and effort seriously considering their
suggestions and providing detailed feedback on their merits and
demerits. We simply don't have the resources to do that. Insisting
that people expend a certain amount of time and money to actually attend
a meeting weeds out people who aren't serious and allows face-to-face
discussion which is far less rancorous and much more productive than
on-line discussions. It also increases the committee's resources to
help offset the increased work load.
Do you know where the next meeting is?
Next week in San Jose, CA, USA. The meeting schedule (as far as is
known) is posted on the above page. Meetings for next year have not
been finalized yet, but there are outstanding or pending invitations to
meet in Toronto, CA in April and Santa Cruz, CA, USA in October
(according to the minutes from the last meeting, which are also posted
on the web site).
--
Larry Jones

I don't NEED to compromise my principles, because they don't have
the slightest bearing on what happens to me anyway. -- Calvin
Sep 5 '08 #113
Richard Heathfield <rj*@see.sig.in validwrites:
jacob navia said:
>Ben Bacarisse wrote:

<snip>
>>Because
there is no agreed way to program a flexible array, a list or a map,
everyone writes their own, or uses a published one that is
incompatibl e with all the other published ones out there. It is often
a lot of work just to coax two libraries to work together.

That is why I have been insisting that we adopt the operator overloading
feature that would allow using the '[' and ']' notation for general
containers.

I don't think you're in a position to insist, are you? Not even Microsoft
is in a position to insist on a change to the C language. In fact, not
even Dennis Ritchie is in that position.

It is sometimes difficult to remember that what one person sees as an
obvious improvement, another person sees as a hideous wart. Putting
oneself in another person's position is a useful and informative
intellectual exercise. Think up a change to C that you would really NOT
like to see in the language, and you should get the idea.

By the way, I'm not particularly against the idea of introducing operator
overloading into C (although many people probably are). But
politicking
I would sooner boil my nuts in a vat of sun flower oil than agree that
operator overloading in C is a good idea.
about it in comp.lang.c isn't going to get you anywhere. It's the ISO
people, not us, that you have to convince, and they are going to take a
lot of convincing after the drubbing they took over C99.
--
Sep 5 '08 #114

"Nick Keighley" <ni************ ******@hotmail. comwrote in message
>
>>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.
>so why did IPv6 use 128 bits?
maybe it wasn't well designed. I can't imagine they had more than 2^64 bytes
of memory installed.
OTOH it might have been a signals processing device. These don't really use
integers in the normal C sense of the term. The integers are representations
of real valued signals, and highly specialised.
--
Nick Keighley

Sep 6 '08 #115
Richard wrote:
I would sooner boil my nuts in a vat of sun flower oil than agree that
operator overloading in C is a good idea.
Should I send you olive oil maybe?
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Sep 6 '08 #116
On Sep 5, 1:45*pm, Nick Keighley <nick_keighley_ nos...@hotmail. com>
wrote:
On Sep 4, 8:47*pm, "Malcolm McLean" <regniz...@btin ternet.comwrote :
"Richard Heathfield" <r...@see.sig.i nvalidwrote 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.

so why did IPv6 use 128 bits?
That's as in TCP/IP the internet protocol. "old" IP (v4) used 32-bit
addresses (usually shown in dotted notation eg. 192.12.0.1). Because
the
address space is sparsely used they started to run out of addresses.
Telephone numbers suffer from the same problem. Hence London (UK) got
renumbered *twice* in recent years.

One fix for the IP address problem was a "new" IP standard, v6 (no-one
knows what happened to v5 :-) ). Initially 64 bits was proposed.
According
to their model this would allow everyone on the planet to have an IP
address.
But looking the then rate of technological progress it was realised
they should allow multiple IP addresses per person. This has now
happened;
my home isn't particualrly technology dense but I have several
ip addresses. Hence they went for 128 bits which is expected to last
for
quite a while. So there is already an application that finds 64 bits
inadequate without the need for 16 exa-bytes of memory.

--
Nick Keighley
Sep 6 '08 #117
Nick Keighley wrote:
On Sep 5, 1:45 pm, Nick Keighley <nick_keighley_ nos...@hotmail. com>
>so why did IPv6 use 128 bits?
....
my home isn't particualrly technology dense but I have several
ip addresses. Hence they went for 128 bits which is expected to last
for
quite a while. So there is already an application that finds 64 bits
inadequate without the need for 16 exa-bytes of memory.
This is little to do with needing 128-bit integers. This application needs a
16-byte identifier for the same sorts of reasons that credit cards mostly
use 16-digit numbers.

And it's unlikely that IP addresses need ALU support for +, -, * and /
operations. Possibly logical operations but this can easily be achieved on a
64-bit CPU without having a 128-bit word length.

--
Bartc

Sep 6 '08 #118
Nick Keighley said:

<snip>
But looking the then rate of technological progress it was realised
they should allow multiple IP addresses per person. This has now
happened;
my home isn't particualrly technology dense but I have several
ip addresses. Hence they went for 128 bits which is expected to last
for
quite a while. So there is already an application that finds 64 bits
inadequate without the need for 16 exa-bytes of memory.
Furthermore, cryptographical ly-inclined programmers will happily take the
biggest ints you can give them, and then beg for still bigger ints.

--
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 6 '08 #119

"Nick Keighley" <ni************ ******@hotmail. comwrote in message
>Telephone numbers suffer from the same problem. Hence London (UK) got
renumbered *twice* in recent years.
I'm of the opinon that 3074457345 telephones ought to be enough for anyone,
if 64 bit integers were distributed fairly instead of being hogged by the
rich nations.

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

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
5671
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
9464
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
10122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10061
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...
1
7471
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
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
2860
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.