bugGNU Octave - Bugs: bug #51784, mexGetVariable does returns empty...

 
 

bug #51784: mexGetVariable does returns empty matrix instead of nullptr for non-existant global variables

Submitted by:  Piotr Held <jsoh425>
Submitted on:  Fri 18 Aug 2017 05:30:39 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: Works For MeAssigned to: None
Originator Name: Piotr HeldOpen/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 23 Aug 2017 11:14:47 PM UTC, comment #3:

I'm sorry for the hassle. I downloaded a fresh new version from the repo and you're right, it does work. I don't know why it didn't work on a previous build of mine (the code seems to be the same in the crucial parts). You can close this bug.

Piotr Held <jsoh425>
Wed 23 Aug 2017 10:19:04 PM UTC, comment #2:

This works for me already without the patch. Could you verify that this is really necessary? There is a quirk in that run-octave doesn't work for testing. You need to install a version to some location like ~/local and execute that copy of Octave.

I've attached a file mygetv.c. Try

In neither case is the empty matrix [] returned even though the variable "a" does not exist.

(file #41633)

Rik <rik5>
Project Administrator
Wed 23 Aug 2017 04:05:19 PM UTC, comment #1:

The mex api call that I am referring to looks like this:

If SOME_GLOBAL_VARIABLE doesn't exist GNU Octave currently returns a null matrix (zeros(0,0)), and according to Matlab documentation and Matlab behavior mexGetVariable should return nullptr in such a case.

Piotr Held <jsoh425>
Fri 18 Aug 2017 05:30:39 PM UTC, original submission:

I double checked this with Matlab (and their documentation) and the way it's suppose to work is that if the global variable doesn't exist mexGetVariable should return nullptr. Currently it returns an empty matrix.

I am attaching patch to fix this problem.

Piotr Held <jsoh425>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #41633:  mygetv.c added by rik5 (489B - text/x-csrc)
file #41571:  patch_mexGetVariable.diff added by jsoh425 (909B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Updated the item)
  • -unavailable- added by jsoh425 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 24 Aug 2017 03:46:55 PM UTCrik5StatusNeed Info=>Works For Me
      Open/ClosedOpen=>Closed
    Wed 23 Aug 2017 10:19:04 PM UTCrik5Attached File-=>Added mygetv.c, #41633
      StatusNone=>Need Info
    Fri 18 Aug 2017 05:30:39 PM UTCjsoh425Attached File-=>Added patch_mexGetVariable.diff, #41571

    Back to the top


    Powered by Savane 3.1-cleanup1