LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-06-2009, 10:40 PM   #1
rardin
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Rep: Reputation: 0
hii


sbdsa

Last edited by rardin; 11-07-2009 at 05:29 PM.
 
Old 11-06-2009, 10:41 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
with no libraries:
DOS = difficult.
LINUX = impossable.
 
Old 11-07-2009, 12:33 AM   #3
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,732
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
I tried the following code as it is on suse 10.3 with the default gcc compilor! While compilation it gave a warning but still compiled without errors and gave the expected output !

int main ()
{
printf ("\nThank God !\n");
return 0;
}


Is this what u wanted ?
 
Old 11-07-2009, 12:40 AM   #4
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by smeezekitty View Post
with no libraries:
LINUX = impossable.
bull. Its possible. And, its spelt "impossible".
 
Old 11-07-2009, 02:39 AM   #5
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by ghostdog74 View Post
bull. Its possible. And, its spelt "impossible".
then show.
 
Old 11-07-2009, 02:59 AM   #6
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by smeezekitty View Post
then show.
ever heard of assembly?
 
Old 11-07-2009, 03:39 AM   #7
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
This story comes close...
 
Old 11-07-2009, 03:48 AM   #8
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
You can probably write it using assembly. But, what a stupid interview question. When would you ever need to do this ? Goodness, how much dumber can they get.

All of a sudden the servers all crash, but one is left in a state of limbo, nothing works except gcc and nasm, but the standard libraries have been disabled/deleted. Your only hope is to use gcc or nasm to write a small program to say "hello world", thus telling everyone that everything is ok and not to panic.
 
Old 11-07-2009, 04:08 AM   #9
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by H_TeXMeX_H View Post
You can probably write it using assembly. But, what a stupid interview question.
the point i am making is just to refute what smeezekitty said. In Linux, it is not impossible.
 
Old 11-07-2009, 07:20 AM   #10
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
Quote:
Originally Posted by H_TeXMeX_H View Post
You can probably write it using assembly. But, what a stupid interview question. When would you ever need to do this ? Goodness, how much dumber can they get.
I suspect that the point of the question is to probe creativity and general knowledge. When I was interviewing, I'd ask questions like this. The point wasn't to write such a program - what I wanted to hear was HOW you'd write it. Do you know the difference between a system call and a library call? Do you know what /dev/tty is?

And no, "That's dumb" wouldn't have been a good answer :-)
 
Old 11-07-2009, 08:31 AM   #11
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by pcunix View Post
I suspect that the point of the question is to probe creativity and general knowledge. When I was interviewing, I'd ask questions like this. The point wasn't to write such a program - what I wanted to hear was HOW you'd write it. Do you know the difference between a system call and a library call? Do you know what /dev/tty is?

And no, "That's dumb" wouldn't have been a good answer :-)
Oh, well, but they didn't ask how. They asked you to do it.

I'm sure they could have come up with not only something better, but something meaningful.
 
Old 11-07-2009, 11:05 AM   #12
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
Quote:
Originally Posted by H_TeXMeX_H View Post
Oh, well, but they didn't ask how. They asked you to do it.

I'm sure they could have come up with not only something better, but something meaningful.
Not to be pedantic, but seeing a written program also answers "how" :-)

Interviewing is tough. A lot of people who really aren't worth hiring can answer the easy stuff. Stepping outside of comfort zones, even if unrealistic, can tell you a lot about a persons true abilities.

It's especially the case when you aren't necessarily looking for specific skills so much as general problem solver.

BTW, Google is famous for asking tough interview questions - sometimes very specific, but sometimes real flights of fancy.
 
Old 11-07-2009, 12:40 PM   #13
rob.rice
Senior Member
 
Registered: Apr 2004
Distribution: slack what ever
Posts: 1,076

Rep: Reputation: 205Reputation: 205Reputation: 205
format ELF executable 3
entry start

segment readable executable

start:

mov eax,4
mov ebx,1
mov ecx,msg
mov edx,msg_size
int 0x80

mov eax,1
xor ebx,ebx
int 0x80

segment readable writeable

msg db 'Hello world!',0xA
msg_size = $-msg

now that I have shown you how it's done
I leave it up to you to find the assembler this syntax works with

Last edited by rob.rice; 11-07-2009 at 12:42 PM.
 
Old 11-07-2009, 04:34 PM   #14
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by H_TeXMeX_H View Post
You can probably write it using assembly. But, what a stupid interview question. When would you ever need to do this ? Goodness, how much dumber can they get.

All of a sudden the servers all crash, but one is left in a state of limbo, nothing works except gcc and nasm, but the standard libraries have been disabled/deleted. Your only hope is to use gcc or nasm to write a small program to say "hello world", thus telling everyone that everything is ok and not to panic.
No, the question is not dumb, and there are real needs for things like that.

When I was much younger, I managed to understand how "C" runtime in Borland's Turbo-C was linked to 'main' and how to avoid the linking.

After that I managed to use that Turbo-C to write in "C" for bare metal (with bare minimum inline assembly). That was my job at the time - to write for bare metal. And I was using VGA memory directly for output, so even BIOS was bypassed. And it was actually interesting and useful - I used to "allocate" different screen areas (i.e. various areas in VGA memory) for different diagnostic messages, so I could effectively have a number of checkpoints in my program.

Furthermore, VGA memory was big enough for some small programs/tests - for example, I could test a potentially faulty RAM module - the memory test resided in that VGA memory in the page not currently displayed on screen.

From time to time I (still ?) see job ads with part of job description being programming for bare metal.
 
Old 11-07-2009, 04:42 PM   #15
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by Sergei Steshenko View Post
No, the question is not dumb, and there are real needs for things like that.

When I was much younger, I managed to understand how "C" runtime in Borland's Turbo-C was linked to 'main' and how to avoid the linking.

After that I managed to use that Turbo-C to write in "C" for bare metal (with bare minimum inline assembly). That was my job at the time - to write for bare metal. And I was using VGA memory directly for output, so even BIOS was bypassed. And it was actually interesting and useful - I used to "allocate" different screen areas (i.e. various areas in VGA memory) for different diagnostic messages, so I could effectively have a number of checkpoints in my program.

Furthermore, VGA memory was big enough for some small programs/tests - for example, I could test a potentially faulty RAM module - the memory test resided in that VGA memory in the page not currently displayed on screen.

From time to time I (still ?) see job ads with part of job description being programming for bare metal.
Thats different, linux is a high level protected mode environment that you cannot just call interrupt 0x10 to do the printing.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
program for scanning libraries kpachopoulos Linux - Software 3 07-31-2009 04:51 PM
how to see which libraries a binary program needs r00tb33r Linux - Software 4 02-23-2008 05:22 AM
C++ hello world program error bahadur Programming 23 07-18-2006 12:04 PM
Linking program with .a libraries rudy2 Programming 2 04-22-2005 05:36 AM
How to check which libraries does a program use? sceadu Programming 7 12-27-2004 07:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration