lpcware

Strange code in lpc175x_6x lib USBCDC demo

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by ivbor on Mon Apr 14 04:39:11 MST 2014
Folder:\lpc175x_6x\Examples\USBDEV\USBCDC\, file: cdcuser.c
lines 72 and 73

/*----------------------------------------------------------------------------
  read data from CDC_OutBuf
*---------------------------------------------------------------------------*/
int CDC_RdOutBuf (char *buffer, const int *length) {
  int bytesToRead, bytesRead;

  /* Read *length bytes, block if *bytes are not available*/
  bytesToRead = *length;
  bytesToRead = (bytesToRead < (*length)) ? bytesToRead : (*length);
  bytesRead = bytesToRead;

In which case bytesToRead < (*length) will retun true? Is it possible? Thx

Outcomes