LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 06-07-2016, 10:58 PM   #1
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Rep: Reputation: 52
programming oddity


This is in Gambas 3 but my question is more about what could happen at the OS level.
The oddity is that I have 2 consecutive lines of code (nothing between the 2 lines, not even a comment), line number 1 is
Code:
print variable
and the following line is
Code:
print #x variable
"variable" being exactly the same. Obviously the first line prints the variable on the screen while the second line saves the same variable to a disk file but the results are different. Before the code is executed the same text (variable) is converted to lowercase (lower() which works correctly).
Code:
variable = lower(old_variable)
While the first line of code displays the converted (lower() line of text (variable), the second line of code saves the original line of text (the line before lower() = old_variable) and I am baffled by this result, trying various possible combinations give the same result.
It seems that the Gambas interpreter has a reference to a particular area of memory for the display to the screen and a reference to another area of memory for saving the same variable content to disk.
Could this just be due to a faulty design in the interpreter? Or could there be another explanation?

Thank you for your help
 
Old 06-08-2016, 12:07 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,860
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
please create a complete minimal example that shows the problem.
http://stackoverflow.com/help/mcve
 
Old 06-08-2016, 12:42 AM   #3
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
Quote:
Originally Posted by rblampain View Post
Code:
print #x variable
checking the docu , http://gambaswiki.org/wiki/lang/print , I can say that at least you miss a comma
Code:
print #x , variable
the other thing is that your file, to whatever x points, needs to be opened, what is somethign you missed to post
http://gambaswiki.org/wiki/lang/open

the 3rd thing is, please read this sticky thread what-information-to-include-in-a-post-and-how-to-use-code-tags since the topic 'programming oddity' is meaningless to me and you question is missing a useful sample demonstrating the problem
 
1 members found this post helpful.
Old 06-08-2016, 08:09 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Can you obtain an assembly listing output when you use the interpreter? If you can, this would likely give you a direct answer as to exactly what it is doing when it interprets the different lines of source.
 
Old 06-17-2016, 09:33 PM   #5
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Original Poster
Rep: Reputation: 52
My apologies about the unexpected long delay during which the computer was turned off. When rebooting, I found this strange behaviour had disappeared even though no change had been made.
 
  


Reply



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
More of an oddity than a problem... Neowulf Linux - Newbie 3 11-09-2005 04:49 PM
SSH Oddity DirtyDan Linux - Networking 2 10-24-2005 12:15 AM
nologin oddity prn Linux - Security 2 04-22-2005 05:01 PM
Gnome 2.8 Oddity inescapeableus Linux - Software 2 01-10-2005 03:00 AM
sendmail oddity? bgnrsmnd Linux - Newbie 0 10-27-2003 12:50 PM

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

All times are GMT -5. The time now is 12:04 PM.

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