bugGNU Octave - Bugs: bug #47320, new function devnull

 
 

bug #47320: new function devnull

Submitted by:  Carnë Draug <carandraug>
Submitted on:  Wed 02 Mar 2016 02:06:46 PM UTC  
 
Category: Octave FunctionSeverity: 1 - Wish
Priority: 5 - NormalItem Group: Feature Request
Status: NoneAssigned to: Carnë Draug <carandraug>
Originator Name: Open/Closed: Open
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.

 

(Jump to the original submission Jump to the original submission)

Fri 25 Mar 2016 03:56:12 AM UTC, comment #6:

Would this be for the benefit of users or of core Octave scripts? Rik's observations seem mainly relevant if the goal is to reduce the code size of Octave itself.

Python is used for many systems tasks, and so it is natural that it would need this more often than Octave does. I can't think of any applications for which Octave is a natural choice that would use this.

However perhaps it could be part of a system-specific structure variable, with all sorts of OS/machine/compilation-specific variables, like file-separator, case-sensitivity of file names, endian-ness, 64-bit indexing etc.

Is there already a structure like that? How can a .m file find out that information?

Lachlan Andrew <lachlan>
Project Member
Wed 02 Mar 2016 06:50:44 PM UTC, comment #5:

Yes, "NUL" is the "/dev/null" equivalent for Windows.

The question for me is whether it would be used frequently enough to justify its existence. In the core scripts, "NUL" is only used twice in print.m which doesn't seem sufficient.

In libinterp, it is used only three times in the dldfcn directory for _delaunayn_.cc, _voronoi_.cc, convhulln.cc. In C++ you would probably still use ifdefs rather than an external function to get this information.

Rik <rik5>
Project Administrator
Wed 02 Mar 2016 05:40:32 PM UTC, comment #4:

I'm assuming so. I don't know Windows but when reading on the internet, it found things like "cmd 2> NUL" being recommended for Windows.

Carnë Draug <carandraug>
Project MemberIn charge of this item.
Wed 02 Mar 2016 05:25:44 PM UTC, comment #3:

Does writing to or reading from "NUL" as a file in the mxe-octave build do what I'm assuming it should?

If so I'd say this is a good idea.

Mike Miller <mtmiller>
Project Administrator
Wed 02 Mar 2016 04:48:03 PM UTC, comment #2:

Yes, it would be pretty much the same amount of lines in C++. But is it ok to add yet another function that does this?

Carnë Draug <carandraug>
Project MemberIn charge of this item.
Wed 02 Mar 2016 03:00:56 PM UTC, comment #1:

It seems like it could be a simple .m file:

John W. Eaton <jwe>
Project Administrator
Wed 02 Mar 2016 02:06:46 PM UTC, original submission:

Python has os.devnull which:

> The file path of the null device. For example: '/dev/null' for POSIX, 'nul' for Windows.


We could have devnull() in Octave too. I would place this in libinterp/corefcn/file-io.cc next to stdout, stdin, and stderr. But those return file handles since they are already open. For devnull that's not necessarily true. Any opinions?

I looked into libgnu and they do:

Carnë Draug <carandraug>
Project MemberIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by carandraug (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):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup1